Arithmetic Operators

Last Updated: Jan 2026


Arithmetic operators are used in C to perform mathematical calculations on values and variables. The main arithmetic operators are:

+    Addition
-    Subtraction
*    Multiplication
/    Division
%    Modulus / Remainder

1. Addition +

The + operator adds two values.

int a = 10;
int b = 5;

int result = a + b;

printf("%d", result); // 15

2. Subtraction -

The - operator subtracts the right-hand value from the left-hand value.

int a = 10;
int b = 5;

int result = a - b;

printf("%d", result); // 5

3. Multiplication *

The * operator is used for multiplication.

int a = 10;
int b = 5;

int result = a * b;

printf("%d", result); // 50

4. Division /

The / operator divides one value by another.

int a = 20;
int b = 5;

int result = a / b;

printf("%d", result); // 4

Important: Integer Division

This is one of the most important concepts in C. If both operands are integers:

int result = 10 / 3;

The mathematical answer is:

3.333333...

But C gives:

3

because both operands are int. The decimal part is discarded. But:

float result = 10.0 / 3;
printf("%f", result);

Output:

3.333333

Because 10.0 is a floating-point value.


5. Modulus %

The % operator returns the remainder after integer division.

int result = 17 % 5;

Think:

17 ÷ 5

5 x 3 = 15
17 - 15 = 2

Therefore:

17 % 5 = 2

Arithmetic Operators with Variables

int a = 20;
int b = 6;

printf("%d\n", a + b);
printf("%d\n", a - b);
printf("%d\n", a * b);
printf("%d\n", a / b);
printf("%d\n", a % b);

Output:

26
14
120
3
2

Notice:

20 / 6 = 3
20 % 6 = 2

The division gives the quotient and modulus gives the remainder.



Liked This Tutorial

Scan QR Code To Leave A Review Or

Click Here To Leave A Review
Scan QR