Multiply without using multiplication operator in C and C++

Spread the love

C Program to multiply positive integers x and y by using addition and subtraction operators only. Means¬†multiply without using multiplication operator. Let’s start.

Algorithm:

  1. Take the input from the user and store them in x and y.
  2. Now create a for loop, That will loop from 1 to the y.
  3. For each iteration, we are going to add x to mul. Mul is variable which is initially 0 and we are adding x to mul. Means we are multiplying the value.
  4. This process will repeat until we reach the y. Once we reach, Loop will break and Multiplication value is stored in variable mul
  5. Display the mul value on the console.

Program :

Output:

muliplying without using multiplication operator in C and C++

 

 

Venkey

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

1 Response

  1. Deepak says:

    It will not work if we enter x greater n y smaller

Leave a Reply