C++ Program to Multiply Two Numbers

This is a simple and easy c++ program to multiply two numbers entered by the user while executing this program. I assume you have basic knowledge of c++ programming language.
In the below program, we have used three variables x, y, and multiplication. x and y to hold the value of entered by the user and then multiply using the multiply operator (x) and store into multiple variables.

Source Code: 

#include <iostream>
using namespace std;
int main()
{
    double firstNumber, secondNumber, productOfTwoNumbers;
    cout << "Enter two numbers: ";
    
    cin >> firstNumber >> secondNumber;
 
    
    productOfTwoNumbers = firstNumber * secondNumber;  
    cout << "Product = " << productOfTwoNumbers;    
    
    return 0;
}

Post a Comment

 
Top