All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Move the 3, Triple the number (Posted on 2004-03-01)
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?

 See The Solution Submitted by Gamer Rating: 3.2000 (5 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 re(4): Standard solution | Comment 10 of 17 |
(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

 Search: Search body:
Forums (0)