Skip to content

Instantly share code, notes, and snippets.

@rahul8590
Created March 8, 2013 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahul8590/5117886 to your computer and use it in GitHub Desktop.
Save rahul8590/5117886 to your computer and use it in GitHub Desktop.
Its a simple implementation of Russians Peasant multiplication algorithm.
#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