Write a c++ program to multiply two numbers without using multiplication operator.
#include<iostream.h> #include<conio.h> void main () { int a,b,i,temp=0; clrscr(); cout<<"Enter Two numbers for multiplication"; cin>>a>>b; for(i=1;i<=b;i++) { temp=temp+a; } cout<<endl<<"Result are:: "<<temp; getch(); }
Description :
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Submit #Terms of Use
Copyright©2011 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com | Powered by Dhyeya
August 25th, 2010 at 10:50 pm
It will not work
1.If a is -ve
2.b is -ve
July 23rd, 2011 at 10:09 am
inefficient program
October 18th, 2011 at 7:18 pm
how include negative numbers?
October 18th, 2011 at 7:18 pm
how include negative numbers?
October 18th, 2011 at 7:18 pm
how include negative numbers?
October 29th, 2011 at 2:02 am
THNAKS
November 16th, 2011 at 10:08 am
thank u sommuch
December 23rd, 2011 at 3:37 pm
how include negative numbers?
January 5th, 2012 at 5:54 pm
// Multiplication.cpp : By Mu’men Yassin (XZz_Yassin)
#include
using namespace std;
int multiplication(int a,int b){
int total=0,c;
if(a>=0){
for (int c=0;c=a+1;c–){
if(b>=0){
total-=b;
}
else{
total-=b;
total=abs(total);
}
}
}
return total;
}
int main()
{
while(true){
int x,y;
char check;
cout <>x;
cout <>y;
cout<<endl<<multiplication(x,y)<<endl;
cout<>check;
cout<<endl;
if(check=='Y' || check=='y'){
continue;
}
else{ //it's never mind if the user entered N or n or else
break;
}
}
cout << "Thnx for using my product, XZz_Yassin 2012\n";
system ("PAUSE");
return 0;
}
January 5th, 2012 at 5:56 pm
// Multiplication.cpp : By Mu'men Yassin (XZz_Yassin)
#include
using namespace std;
int multiplication(int a,int b){
int total=0,c;
if(a>=0){
for (int c=0;c=a+1;c--){
if(b>=0){
total-=b;
}
else{
total-=b;
total=abs(total);
}
}
}
return total;
}
int main()
{
while(true){
int x,y;
char check;
cout <>x;
cout <>y;
cout<<endl<<multiplication(x,y)<<endl;
cout<>check;
cout<<endl;
if(check=='Y' || check=='y'){
continue;
}
else{ //it's never mind if the user entered N or n or else
break;
}
}
cout << "Thnx for using my product, XZz_Yassin 2012\n";
system ("PAUSE");
return 0;
}
January 29th, 2012 at 1:50 pm
thanks