Examples pf C part 11 multiply using addition
Multiply using addition
Program :
Output:
Enter a,b
9
20
Multiplication=180
Explanation:
//Coming Soon
Program :
#include<stdio.h> main() { int a,b,i,multiplication=0; printf("Enter a,b\n"); scanf("%d%d",&a,&b); if(b<0) { a=a+b; b=a-b; a=a-b; } if(a>=0) { for(i=1;i<=a;i++) multiplication+=b; } if(a<0) { for(i=a;i<=-1;i++) multiplication-=b; } printf("Multiplication=%d\n",multiplication); }
Enter a,b
9
20
Multiplication=180
Explanation:
//Coming Soon