In this shot, let’s talk about **arithmetic operators** in the Pascal programming language. We often use these arithmetic operands in condition variables.

Operator | How does it work? | Numerical Example |

+ | This refers to the '+' operator often used in arithmetic calculations. Used to add two numbers. | A=1 B=2 A+B = 3 |

- | This refers to the '-' operator often used in arithmetic calculations. Used to subtract two numbers. | A=10 B=2 A-B = 8 |

* | This refers to the '*' operator often used in arithmetic calculations. Used to take a product of two numbers. | A=10 B=2 A*B = 20 |

div | This refers to the '/' operator often used in arithmetic calculations. Used to perform division operation between two numbers. | A=10 B=2 A div B = 5 |

mod | This refers to the 'mod' operator often used in arithmetic calculations. It returns the remainder after performing two division operation. | A=10 B=3 A mod B = 1 |

```
program calculator;
var a, b, num : integer;
begin
a:=10;
b:=3;
num := a + b;
writeln('A + B ', num );
num := a - b;
writeln('A - B = ', num );
num := a * b;
writeln('A * B = ', num);
num := a mod b;
writeln('A mod B = ' , num );
num := a div b;
writeln('A div B = ', num );
end.
```

```
A + B = 13
A - B = 7
A * B = 30
A mod B = 1
A div B = 3
```

Copyright ©2024 Educative, Inc. All rights reserved

TRENDING TOPICS