CPP program to multiply two numbers
- Home
- Calculations
- CPP program to multiply two numbers
- On
- By
- 0 Comment
- Categories: Calculations, multiply
CPP program to multiply two numbers
CPP program to multiply two numbers
In this tutorial, we will discuss the CPP program to multiply two numbers.
In this topic, we will learn how to multiply two integer number in the C++ programming language
Multiply two integers
Program 1
#include <iostream> #include <conio.h> using namespace std; int main() { cout << "Multiply two integer numbers" << endl; int numberOne, numberTwo,product; cout << "Enter the first number :"; //Enter first integer number cin >> numberOne; //stored first integer number in variable numberOne cout << "Enter second number :"; //Enter second integer number cin >> numberTwo; //stored second integer number in variable numberTwo product=numberOne * numberTwo; //performs multiplication and stored the result in the variable sumofnumbers cout<<"the product is: "<<product; getch(); return 0; }
When the above code is compiled and executed, it produces the following results
Multiply two integer numbers Enter the first number: 12 Enter second number: 23 product is : 276
This is a simple C++ program to find the product of two integer numbers.
In the above program, we declared two different integer values such as 12 and 23 stored in variables numberOne, numberTwo respectively.
Then, we can find the product of given numbers using the * operator in c++
finally, we could display the result on the screen using the cout function in C++ language.
Multiply two floating point number
Program 2
#include <iostream> #include <conio.h> using namespace std; int main() { cout << "Multiply two floating point numbers\n" <<endl; //description double numberOne, numberTwo,product;//variable declaration cout << "Enter first number :"; //Enter first integer number cin >> numberOne; //stored first integer number in variable numberOne cout << "Enter second number :"; //Enter second integer number cin >> numberTwo; //stored second integer number in variable numberTwo product=numberOne * numberTwo; //performs multiplication and stored the result in the variable sumofnumbers cout<<"the product is "<<product; getch(); return 0; }
When the above code is compiled and executed, it produces the following results
Multiply two floating point numbers Enter the first number: 2.45 Enter second number: 5.5 the product is 13.45
This is a simple C++ program to find the product of two floating point numbers.
In the above program, we declared two different floating point values such as 2.45 and 5.5 stored in variables numberOne, numberTwo respectively.
Then, we can find the product of given numbers using the * operator in c++
finally, we could display the result on the screen using the cout function in C++ language.
Similar post
C++ program to multiply two numbers using function
Java program to multiply two numbers using method
Python program to multiply two numbers using function
C# program to multiply two numbers using function
PHP program to multiply two numbers using function
Find product of two numbers using method in Java
Find product of two numbers using recursion in Java
C program to multiply two numbers
C++ program to multiply two numbers
Java program to multiply two numbers
Python program to multiply two numbers
C# program to multiply two numbers
PHP program to multiply two numbers
JavaScript program to multiply two numbers
Calculate the total of array elements in Java
Calculate the total of array elements in C
Calculate the total of array elements in C++
Java program to calculate sum of array elements
C program to calculate sum of array elements
Java Program to calculate average of array
C Program to calculate average of array
Java Program to calculate average of odd and even numbers in an array
Java Program to calculate average of odd and even numbers
C Program to calculate average of odd and even numbers in an array
C Program to calculate average of odd and even numbers
C++ Program to calculate average of odd and even numbers in an array
C++ Program to calculate average of odd and even numbers