Calculations

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

 

 

C program to multiply two numbers
Python program to multiply two numbers
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

Python code to Calculate sum of odd and even in a list

Python code to Calculate sum of odd and even in a list In this tutorial,…

7 hours ago

How to find reverse number using method in Java

How to find reverse number using method In this article, we will discuss the concept…

3 days ago

C# inverted full pyramid star pattern

C# inverted full pyramid star pattern In this article, we will discuss the concept of…

3 weeks ago

C# Full Pyramid star pattern program

C# Full Pyramid star pattern program In this article, we will discuss the concept of…

1 month ago

Program to count vowels,consonants,words, characters and space in Java

Program to count vowels, consonants, words, characters and space in Java In this article, we…

1 month ago

How to print multiplication table using Array in C++ language

How to print multiplication table using Array in C++ language In this post, we will…

1 month ago