Quotient and Remainder Calculator
Enter a dividend and divisor to find the quotient, remainder, mod operation, and step-by-step long division.
What are Quotient and Remainder?
When we divide one whole number by another, we get two components: the quotient and the remainder. The quotient is the number of whole times the divisor fits into the dividend. The remainder is what is left over after those complete fits have been subtracted out.
For example, dividing 17 by 5: 5 goes into 17 three full times (3 × 5 = 15), leaving 17 − 15 = 2 left over. So the quotient is 3 and the remainder is 2. The remainder is always at least 0 and always less than the divisor.
The Division Algorithm: a = q·b + r
The Division Algorithm is a formal guarantee: for any integers a (dividend) and b (divisor) with b ≠0, there exist unique integers q (quotient) and r (remainder) such that:
a = q × b + r, where 0 ≤ r < |b|
The uniqueness is critical: there is exactly one valid pair (q, r) for each (a, b). This theorem is fundamental in number theory and algebra — it is the basis for the Euclidean algorithm for computing GCD, modular arithmetic, and polynomial long division.
Long Division Step-by-Step
Long division works digit by digit from left to right:
- Bring down the first digit (or the first group of digits that is at least as large as the divisor).
- Determine how many times the divisor fits into that group — this is the first digit of the quotient.
- Multiply that quotient digit by the divisor and subtract from the group.
- Bring down the next digit and repeat steps 2–3.
- When no digits remain, the last remainder is the final remainder.
What is Modulo?
The modulo operation (written a mod b or a % b) returns only the remainder when a is divided by b. For positive integers, modulo and remainder are identical. For example, 17 mod 5 = 2, 100 mod 7 = 2, 360 mod 360 = 0.
Modulo is everywhere in computing: it wraps array indices cyclically, converts between time zones, generates hash values, and drives the Caesar cipher. The expression (n mod m) always produces a result in the range [0, m−1], making it perfect for producing bounded cyclic values.
Negative Numbers in Division
Negative numbers create a choice of convention. Truncation division (used by most programming languages like C, Java, JavaScript) rounds the quotient toward zero: −17 ÷ 5 gives quotient −3, remainder −2 (since −3 × 5 + (−2) = −17). Floor division (used in Python, and matching the mathematical definition of modulo) rounds the quotient toward −∞: −17 ÷ 5 gives quotient −4, remainder 3 (since −4 × 5 + 3 = −17).
This calculator uses floor division (the true mathematical modulo) for negative dividends, which ensures the remainder is always non-negative. Both conventions satisfy a = q × b + r; they just choose different q and r pairs.
Real-World Uses
Clock arithmetic is modular arithmetic mod 12 (or 24): 3 hours after 11:00 is (11 + 3) mod 12 = 2:00. Day-of-week calculations use mod 7. Even/odd testing is just checking n mod 2. In computer science, hash tables use mod to map arbitrary integers to array indices; circular buffers use mod to wrap around; checksums and error-detecting codes are built on modular arithmetic. Dividing items equally — say, 100 cookies among 7 children — gives each child 14 (quotient) with 2 left over (remainder).