After we reach i = 0, what remains is r, the remainder.

In the particular example of 12345/12, we stopped with the remainder which was 9. However, we could continue, by writing 12345 as 12345.0000... Then we bring down the digit 0, place a decimal point in the quotient row, and then look for the largest multiple of 12 that will go into 90, and so on.

**Why Long Division works**

In the long division procedure, the dividend must equal the sum of the remainder and all the numbers that have been subtracted.

But the numbers subracted are d×q_{i} with place value 10^{i}. So

*a* = (d × q_{n})10^{n} +(d × q_{n-1})10^{n-1} + ... + (d × q_{1})10^{1} + (d × q_{0}) + r, where 0 ≤ r < d

= d × (q_{n}10^{n} + q_{n-1}10^{n-1} + ... + q_{1}10^{1} + q_{0}) + r

= d × q_{n}q_{n-1}...q_{1}q_{0} + r

= d × *q* + r, 0 ≤ r < d.

Enter the Division Algorithm!

According to it, *q* and r must be unique. That is, the *q* we have found in the long division is indeed the one and only value possible, namely the quotient of *a* when divided by d.

Now that we know why long division works, it is easy to extend to dividends that are not integers.
Suppose *a* = 758.9 and d =5. Then *a*/5 = (1/10)(7589/5) so that we carry out the long division involving two integers and then divide the answer by 10 which is accomplished by moving the decimal point left.
Finally, noting that the Division Algorithm is valid in any base, we can extend these arguments to any base just as well for base 10.

-- G.R.T.