In this tutorial, we will write a C++ program to calculate the multiplication of two numbers. You may go through the following topics in C++ before writing a C++ program to find a product of two numbers.
It is a simple program that takes two numbers from the user as input and multiplies them. We will use an arithmetic operator (
*) to compute the product.
3 * 5 = 15.
C++ Program to Multiply two Numbers
//C++ Program to Calculate Multiplication of two Numbers
using namespace std;
double num1, num2, product;
cout << "Enter the 1st number: ";
cin >> num1;
cout << "Enter the 2nd number: ";
cin >> num2;
//computing the product
product = num1 * num2;
cout << "\nProduct: " << product;
Enter the 1st number: 5
Enter the 2nd number: 8
You can change the data type as required to find the product of two numbers in C++.