Popular Tutorials
Start Learning C++Certification Courses
Created with over a decade of experience and thousands of feedback.
Python online compiler
JavaScript online compiler
SQL online compiler
Java online compiler
HTML online compiler
C online compiler
C++ online compiler
C# online compiler
PHP online compiler
Swift online compiler
Kotlin online compiler
TypeScript online compiler
Go online compiler
Rust online compiler
Scala online compiler
Dart online compiler
R online compiler
Ruby online compiler
C++ Program to Multiply two Numbers
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.
C++Program to Multiply Two Numbers
#include <iostream>
using namespace std;
int main() {
double num1, num2, product;
cout << "Enter two numbers: ";
// stores two floating point numbers in num1 and num2 respectively
cin >> num1 >> num2;
// performs multiplication and stores the result in product variable
product = num1 * num2;
cout << "Product = " << product;
return 0;
}
Output
Enter two numbers: 3.4 5.5 Product = 18.7
In this program, the user is asked to enter two numbers. These two numbers entered by the user are stored in variable num1 and num2 respectively.
Then, the product of num1 and num2 is evaluated and the result is stored in variable product.
Finally, the product is displayed on the screen.
Also Read:
Did you find this article helpful?