Related Tags

operators
pascal

# What are arithmetic operators in Pascal expressions?

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=1B=2A+B = 3 - This refers to the '-' operator often used in arithmetic calculations. Used to subtract two numbers. A=10B=2A-B = 8 * This refers to the '*' operator often used in arithmetic calculations. Used to take a product of two numbers. A=10B=2A*B = 20 div This refers to the '/' operator often used in arithmetic calculations. Used to perform division operation between two numbers. A=10B=2A 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=10B=3A mod B = 1

## Code

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.


### Output:

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


RELATED TAGS

operators
pascal

CONTRIBUTOR