Google News
logo
C++ Program to Multiply two Numbers
In the following example of C++ program to multiply two numbers :
Program :
#include <iostream>

int main() {
    float num1, num2, product;
    std::cout << "Enter two numbers: ";
    std::cin >> num1 >> num2;
    product = num1 * num2;
    std::cout << "Product = " << product << std::endl;
    return 0;
}
Output :
Enter two numbers: 7
15
Product = 105
* This program takes two inputs from the user num1 and num2, which represent the two numbers to be multiplied.

* It then multiplies num1 and num2 together using the * operator and assigns the result to the variable product.

* Finally, the program outputs the product of num1 and num2 to the console using std::cout.