C program to multiply two numbers 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

Algorithm to multiply two numbers

  1. Take two input values. first, second
  2. Set mul = 0
  3. Traverse from i = 1 till second value
    If i<=second
    mul= mul+first
    i++
  4. Print Multiplication of two numbers. mul

C program to multiply two numbers without using multiplication operator

#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 :-

C program to multiply two numbers without using multiplication operator

Write A Comment