# Arithmetic Operations In C

Basic arithmetic operations include addition, subtraction, multiplication and subtraction. They are performed on numerical data types like `int`, `float` and `double`.

The example code given below explains addition in C.

```#include <stdio.h>

int main() {
int op1, op2, sum;      // variable declaration

op1 = 5;                // variable definition
op2 = 3;

sum = op1 + op2;        // addition operation

printf("sum of %d and %d is %d", op1, op2, sum);
}
```

The output of the program should be −

```sum of 5 and 3 is 8
```

## Subtraction operation in C

The example code given below explains subtraction operation in C.

```#include <stdio.h>

int main() {
int op1, op2, sub;      // variable declaration

op1 = 5;                // variable definition
op2 = 3;

sub = op1 - op2;        // subtraction operation

printf("Output of %d − %d is %d", op1, op2, sub);
}
```

The output of the program should be −

```Output of 5 − 3 is 2
```

## Multiplication operation in C

The example code given below explains multiplication in C. Asterisk or `*` is used as multiplication operator.

```#include <stdio.h>

int main() {
int op1, op2, mul;      // variable declaration

op1 = 5;                // variable definition
op2 = 3;

mul = op1 * op2;        // multiplication operation

printf("Output of %d multiplied by %d is %d", op1, op2, mul);
}
```

The output of the program should be −

```Output of 5 multiplied by 3 is 15
```

## Division operation in C

The example code given below explains division in C.

```#include <stdio.h>

int main() {
int op1, op2, div;      // variable declaration

op1 = 6;                // variable definition
op2 = 3;

div = 6 / 3;            // division operation

printf("Output of %d divide by %d is %d", op1, op2, div);
}
```

The output of the program should be −

```Output of 6 divide by 3 is 2
```
simple_programs_in_c.htm