fastread homefastrread library fastread menu

C++ : Multiply two Numbers

Tutorial by:Manisha Dubey      Date: 2016-06-18 04:21:46

❰ Previous Next ❱

In this program, user is asked to enter two numbers(either integers or floating point numbers) and this program will mulitply these two numbers and display it.

Source Code


/*C++ program to multiply and display the product of two numbers entered by user. */

#include <iostream>
using namespace std;

int main( )
{
    float n1, n2, product;
    cout << "Enter two numbers: ";
    cin >> n1 >> n2;
    product = n1*n2;
    cout << "Product = " << product;
    return 0;
}

Output

Enter two numbers: 2.4
1.6
Product = 3.84
Enter two numbers: 11
13
Product = 143

 

 
 

In this program, user is asked to enter two numbers. These two numbers entered by user will be stored in variables n1 and n2 respectively. This is done using cin() function. Then, * operator is used for multiplying variables and this value is stored in variable product.

Then, the product is displayed and program is terminated.

❰ Previous Next ❱


C++

Submit Your Thought, Tutorial, Articls etc.

Submit Your Information India's Number one online promotion website