Accept two numbers from the user...

...and multiply these two numbers without using the multiplication operator!
using any loop!

Questions by cguyc

Showing Answers 1 - 2 of 2 Answers

Er.Kunal

  • Jul 22nd, 2012
 

I have included the code herein for u.

Code
  1.  

  2.  

  3. //Program for Multiplication without using multiplication operator written by Er.Kunal

  4. #include<stdio.h>

  5. #include<conio.h>

  6. void main()

  7. {

  8.    int multiplicand,multiplier,i,result=0;

  9. clrscr();

  10. printf("Enter multiplicand and multiplier:");

  11. scanf("%d%d",&multiplicand,&multiplier);


  12. You entered multiplicand=%d

  13. multiplier=%d",multiplicand,multiplier);

  14. for(i=1;i<=multiplier;i++)

  15. {

  16. result=result+multiplicand;

  17. }


  18. Your Result is:%d",result);

  19. getch();

  20. }

  Was this answer useful?  Yes

Delbin

  • Jul 22nd, 2012
 

Code
  1. #include<stdio.h>

  2. #include<stdlib.h>

  3. main()

  4. {

  5.         int a,b,result=0;

  6.         scanf("%d%d",&a,&b);

  7.         while(a)

  8.         {

  9.                 result=result+b;

  10.                 a--;

  11.         }

  12.         printf("%d

  13. ",result);

  14. }

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions