Program | MULTIPLY.C MULTIPLY.CPP MULTIPLY.PAS |
Multiplication of natural numbers in general is a cumbersome operation. In some cases however the product can be obtained by moving the last digit to the front.
Example: 179487 * 4 = 717948
Of course this property depends on the number system you use, in the above example
we used the decimal representation. In base 9 we have a shorter example:
17 * 4 = 71 (base 9)
as (9 * 1 + 7) * 4 = 7 * 9 + 1
Sample Input
10 7 4
9 7 4
7 4 2
Sample Output
179487
17
210352456314