Q:

Write a C++ Program to Calculate Multiplication of two Numbers

belongs to collection: C++ Basic Solved Programs

0

Write a C++ Program to Multiply two Numbers. Here’s simple C++ Program to Calculate Multiplication of two Numbers in C++ Programming Language.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

In this program, user is asked to enter two numbers (floating point numbers). Then, the product of those two numbers is stored in a variable and displayed on the screen.

 
 

Here is source code of the C++ Program to Calculate Multiplication of two Numbers. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.


SOURCE CODE : :

/*  C++ Program to Calculate Multiplication of two Numbers  */

#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 [ "<<first<<" * "<<second<<" ] = " << product<<"\n";

    return 0;
}

Output : :


/*  C++ Program to Calculate Multiplication of two Numbers  */

Enter 1st number :: 5

Enter 2nd number :: 8

Product of Two  Numbers [ 5 * 8 ] = 40

Process returned 0

  • In this program, user is asked to enter two numbers. These two numbers entered by the user is stored in variable first and second respectively.
  • Then, the product of first and second is evaluated and the result is stored in variable product.
  • Finally, the product is displayed on the screen.

Above is the source code for C++ Program to Calculate Multiplication of two Numbers which is successfully compiled and run on Windows System.The Output of the program is shown above .

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Basic Solved Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a C++ Program to Display ASCII Value of a Ch... >>
<< C++ Program to Find Size of Int Float Double and C...