Wednesday 27 June 2012

c++ program that multiply two given numbers without using * or / operator.


#include<iostream>
using namespace std;

int main()
{
int a,b,i,temp=0;

//taking input form user
cout<<"Enter First number for multiplication:  ";
cin>>a;


cout<<"Enter Second number for multiplication:  ";
cin>>b;

for(i=1;i<=b;i++)
{

temp=temp+a;

}
cout<<endl<<"Result are:: "<<temp;

return 0;
}

No comments:

Post a Comment