Sample program (multiplication using addition)

by Nideesh C on February 8, 2011 · 2 comments

in C++




#include <iostream.h>

int mult (int x, int y) {
int result;
result = 0;
while (y != 0) {
result = result + x;
y = y – 1;
}
return(result);
}

int main () {
int x, y;
cout << “Enter two natural numbers: “;
cin >> x >> y;
cout << x << ” * ” << y << ” = ” << mult(x,y) << endl;
return(0);
}

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

No related posts.

{ 2 comments… read them below or add one }

1 linda March 4, 2011 at 5:37 am

I need more multiplication by addition programming in another way

Reply

2 Billu March 9, 2011 at 11:15 pm

Sample program (multiplication using addition)

Reply

Leave a Comment

Previous post:

Next post: