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:
1 2 3 4 5 6 7 8 9 | <strong>Input:</strong> First number: <strong>5</strong> Second number: <strong>3</strong> <strong>Output:</strong> Multiplication by addition of 5 and 3 is: <strong>15</strong> <strong>Solution:</strong> Multiplication is = <strong>5 + 5 + 5 = 15</strong> |
C Program to Multiply number using Addition operator
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | //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