Algorithm


1. Start
2. Declare variables num1, num2, and result of type double
3. Prompt the user to enter the first number (num1)
4. Read and store the value of num1 from the user
5. Prompt the user to enter the second number (num2)
6. Read and store the value of num2 from the user
7. Multiply num1 and num2 and store the result in the variable 'result'
8. Display the result of the multiplication
9. End

Code Examples

#1 Code Example- C++Programing to Multiply Two Numbers

Code - C++ Programming

#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;
}
Copy The Code & Try With Live Editor

Output

x
+
cmd
Enter two numbers: 3.4
5.5
Product = 18.7
Advertisements

Demonstration


C++Programing to Multiply Two Numbers-DevsEnv