How to multiply in c++: In the previous article, we have discussed C++ Program to Copy String Without Using strcpy. In this article, we will see C++ Program to Multiply Two Numbers Without Using ‘*’ Operator.
C++ Program to Multiply Two Numbers Without Using ‘*’ Operator
- How to multiply two numbers using addition “+” operator only in C++.
C++ Program to multiply two numbers using addition

#include <iostream>
using namespace std;
int multiply(int a, int b) {
int result = 0;
// Add integer a to result b times
while(b != 0) {
result = result + a;
b--;
}
return result;
}
int main () {
int a, b;
cout << "Enter two integers" << endl;
cin >> a >> b;
cout << a << " X " << b << " = " << multiply(a, b);
return 0;
}
</iostream>
Output
Enter two integers 4 5 4 X 5 = 20
Write simple C++ programs to print a message, swap numbers, and many more to get an idea on how the program works. Here given C++ Programs for Practice are useful to master your coding skills and learn various topics.