In this C++ tutorial, you shall learn about Multiplication Assignment operator, its syntax, and how to use this operator, with examples.

C++ Multiplication Assignment

In C++, Multiplication Assignment Operator is used to find the product of the value (right operand) and this variable (left operand) and assign the result back to this variable (left operand).

The syntax to find the product of a value 2 with variable x and assign the result to x using Multiplication Assignment Operator is

x *= 2


In the following example, we take a variable x with an initial value of 5, multiply it with a value of 2 and assign the result back to x, using Multiplication Assignment Operator.


#include <iostream>
using namespace std;

int main() {
    int x = 5;
    x *= 2;
    cout << "x : " << x << endl;


x : 10
Program ended with exit code: 0


In this C++ Tutorial, we learned about Multiplication Assignment Operator in C++, with examples.