C++ Program to Calculate Multiplication of two Numbers

Problem

Write a C++ Program to Multiply two Numbers.

Solution

The user is prompted to enter two numbers in this program. The product of those two numbers is then stored in a variable and shown on the screen.

Here’s a sample code snippet demonstrating how to calculate Calculate Multiplication of two Numbers in C++.

#include <iostream>
using namespace std;

int main()
{
    double first, second, product;

    cout << "Enter 1st number: ";
    cin >> first;
    cout << "\nEnter 2nd number: ";
    cin >> second;

    product = first * second;

    cout << "\nProduct of Two  Numbers = " << product<<"\n";

    return 0;
}

Output

%d bloggers like this: