Contact Learn C
Copy Program Share Program

Program 266: Program to print Multiplication by using Addition

Program 266: Program to print Multiplication by using Addition

#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);
}

Explanation:

//Coming Soon

Output:
Program to print Multiplication by using Addition

Program to print Multiplication by using Addition




1 comment:

Donate

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide