Russian Peasant Multiplication 2

Description:
Russian Peasant Multiplication.
This program allows one to do multiplication by just doing muliplication or division by 2 (and addition). This is interesting since computers generally use base 2 arithmetic.The algorithm is as follows. Start two rows, one with the multiplicand (say, A) and the other the multiplier (say B). The goal is to multiply A by B. The first number is successively divided by 2 while the second number is multiplied by 2. If the number in the first column is odd, then the correspoinding number in the second column is added to the sum. The final sum is the product. Example:
Multiplicand   Multiplier      Product
37                41           41+0 = 41
18               82
9                164           164+41 = 205
4                328
2                656
1              1312           1312+205 = 1517
Primary Inputs:    Two numbers
Primary Output:    Determine the multiplication of the numbers by the above described method
Platform Used:      JDK 1.6 with Notepad.


4.8/5 - (35 votes)

2 thoughts on “Russian Peasant Multiplication

  1. Reply Hughes Apr 11,2013 1:18 pm

    Your house is valueble for me. Thanks!…

  2. Pingback: hermes replica

Leave a Reply