Write a C program to multiply two numbers using plus operator. Here’s simple program to multiply two numbers using plus operator in C Programming Language.
Given two numbers as input from user, we have to multiply them without using arithmetic operators like * and +. In this program we will multiply two numbers by repetitive addition. In other words, A X B is same as A + A + A… (B times).
For Example : :
5 X 4 = 5 + 5 + 5 + 5 = 20
Below is the source code for C program to multiply two numbers using plus operator which is successfully compiled and run on Windows System to produce desired output as shown below :
SOURCE CODE : :
/* C program to multiply two numbers using plus operator */
#include <stdio.h>
int main()
{
int a,b;
int mul,i;
printf("Enter first number:: ");
scanf("%d",&a);
printf("\nEnter second number:: ");
scanf("%d",&b);
mul=0;
for(i=1;i<=b;i++){
mul += a;
}
printf("\nMultiplication of %d and %d is: %d\n",a,b,mul);
return 0;
}
OUTPUT : :
/* C program to multiply two numbers using plus operator */
Enter first number:: 6
Enter second number:: 7
Multiplication of 6 and 7 is: 42
Above is the source code for C program to multiply two numbers using plus operator which is successfully compiled and run on Windows System.The Output of the program is shown above .
Given two numbers as input from user, we have to multiply them without using arithmetic operators like * and +. In this program we will multiply two numbers by repetitive addition. In other words, A X B is same as A + A + A… (B times).
For Example : :
Below is the source code for C program to multiply two numbers using plus operator which is successfully compiled and run on Windows System to produce desired output as shown below :
SOURCE CODE : :
OUTPUT : :
Above is the source code for C program to multiply two numbers using plus operator which is successfully compiled and run on Windows System.The Output of the program is shown above .
need an explanation for this answer? contact us directly to get an explanation for this answer