If you moved the 3 at the end of a certain large number to the beginning, it would be the same as multiplying it by 3. What is the number?
(In reply to
re(3): Standard solution by Richard)
The program is actually just mimicking long division. The variable temp is just the current partial dividend, and succeeding temp values are just the remainder from the previous division with the next digit brought down from the real dividend, which in this case is just the previous partial(single-digit) quotient, as the digits are all offset by one in the whole quotient and the whole dividend. The appending is done arithmetically by multiplying the previous remainder by 10 before adding the newly-brought-down digit.
The backslash is integer division, producing a whole-number quotient.
|
Posted by Charlie
on 2004-03-02 15:46:41 |