Created
March 8, 2013 16:49
-
-
Save rahul8590/5117886 to your computer and use it in GitHub Desktop.
Its a simple implementation of Russians Peasant multiplication algorithm.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
int main() | |
{ | |
int a,b,c=0; | |
cin >> a >> b; | |
while(a) | |
{ | |
if(a&1) | |
c += b; | |
a>>=1; | |
b<<=1; | |
} | |
cout<<m<<endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment