In this tutorial, we are going to see a new program which is to **C program to multiply two number without using multiplication operator.**

Normally to perform multiplication of numbers we use Multiply operator but in this program, we implement c program to Multiply two numbers without using multiplication operator.

**Example:**

Multiply two numbers

First number = 5, Second number = 4

We Multiply two numbers by adding the first number, the second number of times.

i.e. answer = 5 + 5 + 5 + 5

**Answer = 20**

## C program to multiply two number without using multiplication 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 25 26 27 28 29 30 31 |
#include<stdio.h> void main() { //declare variables int first, second, mul, i; // take two numbers from users printf(" Enter first number :\n"); scanf ("%d",&first); printf ("Enter second number :\n"); scanf ("%d",&second); //main logic begins mul = 0; for(i=1;i<=second;i++) { mul= mul+first; ; } printf("\n multiplication of %d and %d is = %d ", first , second , mul); } |

**Output :-**

**Explanation:**

**1. First start with main where program execution starts.**

**2. Declare the variables**

first => to store first number

second => to store second number

mul => to store multiplication value

i => temporary variable

**3. Take a input from user first number and second number .for example first = 5 and second = 2**

**4. Initialize mul = 0 the initial value.**

**5. Next we write main logic that is to add number second number of times.**

**At first iteration** i = 1 , i initialized to 1 and condition checked i <= second i.e. 1 <= 2 this condition become true and enters in block and statement in block executed.

mul =+ first ;

=> mul = mul + first

=> mul = 0 + 5

=> mul = 5

After this value of i get incremented.

**At second iteration** i = 2 and condition checked i <= 2 => i <= 2 this condition get true again the loop block get executed.

mul =+ first ;

=> mul = mul + first

=> mul = 5 + 5

=> mul = 10

After this value of i get incremented.

**At third iteration** i = 3 , and condition checked i <= 2 => 3 <=2 now the condition get false and execution come out of the loop.

**6. Print multiplication of numbers.**

## Leave a Reply