C++ Program to Multiply two Numbers

  • Write a C++ program to multiply two numbers using * arithmetic operator.

In this program, we are going to perform basic arithmetic operation of multiplying two integers using multiplication(*) operation. Multiplication is one of the five fundamental arithmetic operators supported by C++ programming language, which are addition(+), subtraction(-), multiplication(*), division(/) and modulus(%). Multiplication operator multiplies both operands and returns the result.

For Example:
6 * 5; will evaluate to 30.

C++ Program to Multiply Two Numbers

// C++ program to find product of two numbers
#include <iostream>
using namespace std;

int main() {
    int x, y, product;
    cout << "Enter two integers\n";
    cin >> x >> y;
    // Multiplying x and y
    product = x*y;
    cout << "Product = " << product;
    return 0;
Enter two integers
4 8
Product = 32

In above program, we first take two integers as input from user using cin and store it in variable x and y. Then we multiply x and y using * operator and store the result of multiplication in variable product. Then finally, we print the value of product on screen using cout.

Points to Remember
  • If both operands are integers, then the product of two operands is also an integer.
  • Multiplication operator have higher priority than addition and subtraction operator.