Tuesday, July 28, 2009

Write a program that executes multiplication of two integers , by using the addition operator?

in c language





So, for example if the inputs are 3 and 4, the program will execute 3 times addition of 4: 4+4+4.








please help asap

Write a program that executes multiplication of two integers , by using the addition operator?
The for loop is your friend here.
Reply:#include %26lt;stdio.h%26gt;


int main()


{


int a,b,product=0;


printf("Please enter two integers.\n");


scanf("%d %d",%26amp;a,%26amp;b);


while (a--)


product+=b;


printf("The product is %d\n",b);


return 0;


}

floral centerpieces

No comments:

Post a Comment