By deepshikha

Russian Peasant (Multiply two numbers using bitwise operators) in C++ without using the multiply(x) Operator

Russian peasant Algorithm is an effective way to multiply two numbers without using the multiply operator, this algorithm is on halving and doubling. It is done by- **double the first number and half the second number repeatedly till the second number does not become 1**. In the process, whenever the second number becomes odd, we add the first number to the result.

**Pseudocode**

1) Initialize the result (res as 0).

2) Do the following while the second number is greater than 0.

a) If the second number is odd, add the value first number to the result.

b) Double the first number and half the second number.

3) Return the result(res).

Submitted by deepshikha (deepshikha)

Download packets of source code on Coders Packet

## Comments