05/03/2023

Multiply Two Numbers Without Using Multiplication Operator in C++

Write a Program to Multiply Two Numbers Without Using the Multiplication Operator in C++. Write a C++ program to find the multiplication of two numbers without using Asterisk ( * ) Symbol. There are two methods we can use to solve this problem. This is a very important question for interview purposes because we never think about how we can multiply two numbers without using Asterisk ( * ) Operators. We just take two values and use the Asterisk Sign ( * ) and put them between two variables.

C++ Program to Multiply Two Numbers Without Using Multiplication Operator

Now come to the problem there is two way, So let's take an example suppose we want to multiply 20 and 10 there are two methods you can follow. Let's find out how to multiply without using * Operator.

Multiply Two Numbers Without Using Multiplication Operator in C++


#include <iostream>
using namespace std;

/*Multiply Two Numbers Without Asterisk*/

int main()
{
	long a, b, i, temp = 0;
	cout << "Enter Two numbers for multiplication : \n";
	cin >> a >> b;

	for (i = 1; i <= b; i++)
	{
		temp = temp + a;
	}

	cout << endl << "Multplication of Two Numbers Without Asterisk: " << temp << endl;
}

Method 1: Multiply Two Numbers


You can direct multiple 20 * 10 = 200 this is a very famous Traditional way for calculating or solving multiplication but here one problem occurs in the problem statement specially mentioning that you can not use an Asterisk Sign (*) So you have to Follow another method.

Method 2: Multiply 2 Numbers Without Using * Operators


So here we go we know that multiplication is an addition of one number to another number of (First / Second) times. Don't get you to let's take an example we want to multiply 20 * 10 so we can add 20 into 10 times like 20 + 20 + 20 + 20 + 20 + 20 + 20 + 20 + 20 + 20 = 200 or we can add 10 into 20 times the answer will be same like 10 + 10 + 10 + 10 + 10 + 10 + 10 + 10 + 10 + 10 + 10 + 10 + 10 + 10 + 10 + 10 + 10 + 10 + 10 + 10 = 200.

For solving a mathematical equation there is VEDIC Math(Old Indian Math). If you want to check whether a Number is divisible by 11 or not, you can check in a second. We can take the number 161051 to be divisible by 11 or not. you can check the demo of VEDIC math, 


The Output of Multiply Two Numbers Without Using Multiplication Operator


The Output of Multiply Two Numbers Without Using Multiplication Operator

Similar to Multiply Two Numbers Without Asterisk


Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me

0 Comments: