INTEGER DIVISION
There is a special operator, DIV, used when you wish to
divide one integer by another (ie, you can't use / ). The following
program demonstrates this,
program INTEGER_DIVISION (output); var number1, number2, number3 : integer; begin number1 := 4; number2 := 8; number3 := number2 DIV number1; writeln( number2:2,' divided by ',number1:2,' is ',number3:2) end. Sample Output 8 divided by 4 is 2
The modulus of 20 DIV 5 is 0 The modulus of 21 DIV 5 is 1
program MODULUS (output); var number1, number2, number3 : integer; begin number1 := 3; number2 := 10; number3 := number2 MOD number1; writeln( number2:2,' modulus ',number1:2,' is ',number3:2) end. Sample Output 10 modulus 3 is 1