In this tutorial, we will write a C program to multiply using the plus operator (+). You may go through the following topics in C to understand the program better.
Multiplication of two numbers using plus arithmetic operator:
To find the result of the product of two numbers, we need to add the first number to the second number of times
Example:
Input: First number: 5 Second number: 3 Output: Multiplication by addition of 5 and 3 is: 15 Solution: Multiplication is = 5 + 5 + 5 = 15
C Program to Multiply number using Addition operator
//C program to multiply two numbers using plus operator
#include <stdio.h>
int main()
{
int num1, num2;
int result = 0, i;
printf("Enter the first number: ");
scanf("%d",&num1);
printf("Enter the second number: ");
scanf("%d",&num2);
result=0;
for(i = 1; i <= num2; i++)
result += num1;
printf("\nResult of Multiplication of %d and %d through Addition: %d\n", num1, num2, result);
return 0;
}
Output:
Enter the first number: 5
Enter the second number: 3
Result of Multiplication of 5 and 3 through Addition: 15