Arithmetic Operators

Arithmetic operators in C++ are used to perform mathematical calculations on variables and values. They are commonly used in programs for calculations and problem-solving.

What are Arithmetic Operators?

Arithmetic operators are symbols used to perform basic mathematical operations such as:

  • Addition
  • Subtraction
  • Multiplication
  • Division
  • Modulus

Types of Arithmetic Operators in C++

OperatorOperation
+Addition
-Subtraction
*Multiplication
/Division
%Modulus (Remainder)

Addition Operator (+)

Used to add two values.

Example

#include <iostream>
using namespace std;

int main() {
int a = 10;
int b = 5;

cout << a + b;

return 0;
}

Output

15

Subtraction Operator (-)

Used to subtract one value from another.

Example

cout << 10 - 5;

Multiplication Operator (*)

Used to multiply values.

Example

cout << 4 * 3;

Division Operator (/)

Used to divide values.

Example

cout << 20 / 5;

Modulus Operator (%)

Used to find the remainder after division.

Example

cout << 10 % 3;

Output

1

Complete Example Program

#include <iostream>
using namespace std;

int main() {
int a = 20;
int b = 5;

cout << "Addition: " << a + b << endl;
cout << "Subtraction: " << a - b << endl;
cout << "Multiplication: " << a * b << endl;
cout << "Division: " << a / b << endl;
cout << "Modulus: " << a % b << endl;

return 0;
}

Output

Addition: 25
Subtraction: 15
Multiplication: 100
Division: 4
Modulus: 0

Important Points

  • Division between integers gives integer result
  • Modulus operator works only with integers
  • Arithmetic operators are widely used in calculations

Why Arithmetic Operators are Important

They are important because they:

  • Perform mathematical calculations
  • Help solve programming problems
  • Are used in formulas and algorithms
  • Support data processing

Real-Life Example

Arithmetic operators are used in:

  • Calculating marks
  • Finding salary
  • Shopping bills
  • Banking systems
  • Scientific calculations

Conclusion

Arithmetic operators in C++ are essential tools for performing mathematical operations. They help programs process data, solve calculations, and build logical applications efficiently.

Home » C++ Fundamentals (Beginner Level) > Operators and Conditions > Arithmetic Operators