# What are arithmetic operators give example?

In C, arithmetic operators are used to perform mathematical arithmetic operations such as addition, subtraction, multiplication, division, and mod. The arithmetic operators are applied to two operands. The operators will add up the values, remove them, multiply them, and divide them. The arithmetic operation on the first operand will be performed by the second operand.

C Language supports five arithmetic operators.

## Arithmetic Operators in C

The table below lists all of the arithmetic operators provided by the C programming language.

 Name Operator Example Addition + a + b Subtraction – a – b Multiplication * a * b Division / a / b Mod % a % b

## Addition in C ( + )

Arithmetic addition operator is ‘+’. Arithmetic addition operator is used to perform basic mathematical addition operation between two operands.

``````#include <stdio.h>

int main(int argc, char** argv) {
int a = 8;
int b = 2;
int c = 0;

c = a + b;

printf("a value is : %d\n", a);
printf("b value is : %d\n", b);
printf("\n");
printf("(a + b) is : %d\n", c);

return 0;
}``````

### Output

``````a value is : 8
b value is : 2

(a + b) is : 10``````

## Subtraction in C ( – )

Arithmetic subtraction operator is ‘-‘. Arithmetic subtraction operator is used to perform basic mathematical subtract operation between two operands.

``````#include <stdio.h>

int main(int argc, char** argv) {
int a = 8;
int b = 2;
int c = 0;

c = a - b;

printf("a value is : %d\n", a);
printf("b value is : %d\n", b);
printf("\n");
printf("(a - b) is : %d\n", c);

return 0;
}``````

### Output

``````a value is : 8
b value is : 2

(a - b) is : 6``````

## Multiplication in C ( * )

Arithmetic multiplication operator is ‘*’. Arithmetic multiplication operator is used to perform basic mathematical multiply operation between two operands.

``````#include <stdio.h>

int main(int argc, char** argv) {
int a = 8;
int b = 2;
int c = 0;

c = a * b;

printf("a value is : %d\n", a);
printf("b value is : %d\n", b);
printf("\n");
printf("(a * b) is : %d\n", c);

return 0;
}``````

### Output

``````a value is : 8
b value is : 2

(a * b) is : 16``````

## Division in C ( / )

Arithmetic division operator is ‘/’. Arithmetic division operator is used to perform basic mathematical dividing operation between two operands.

``````#include <stdio.h>

int main(int argc, char** argv) {
int a = 8;
int b = 2;
int c = 0;

c = a / b;

printf("a value is : %d\n", a);
printf("b value is : %d\n", b);
printf("\n");
printf("(a / b) is : %d\n", c);

return 0;
}``````

### Output

``````a value is : 8
b value is : 2

(a / b) is : 4``````

## Mod in C ( % )

Arithmetic mod operator is ‘%’. Arithmetic mod operator is used to perform basic mathematical mod operation between two operands which returns the remainder.

``````#include <stdio.h>

int main(int argc, char** argv) {
int a = 8;
int b = 2;
int c = 0;

c = a % b;

printf("a value is : %d\n", a);
printf("b value is : %d\n", b);
printf("\n");
printf("(a % b) is : %d\n", c);

return 0;
}``````

### Output

``````a value is : 8
b value is : 2

(a % b) is : 0``````