#include<iostream.h>
#include<conio.h>
void main()
{
                int x,y,m=0;
                clrscr();
                cout<<"Enter Two Value : \n";
                cin>>x>>y;
                while(x>0)          //            for(;x>=1;)
                                {
                                if(x%2!=0)
                                                {
                                                m=m+y;
                                                }
                                x=x/2;
                                y=y*2;
                                }
                cout<<"The Multiply Russian Peasant Methods = "<<m;
                getch();
}

41.PNG

Advertisements