In the module "Arithmetic expressions" we talked about the features of the division operation in Pascal.
Recall that for integer data (type integer) you can use three division operations:
/ - normal division, returns a value of type real
div - integer division, when we discard the fractional part as a result of the division operation
mod - calculation of the remainder of division
REMEMBER!
In Pascal the result of dividing an integer by an integer – it's always a real number.
Example:
var a, b, d, e: integer;
c:real;
a := 10;
b := 3;
c := a / b; // Answer: s = 3.33333333333333E+000
d := a mod b; // Answer: d = 1
e := a div b; // Answer: e = 3
These operations are very important in programming. They need to be understood and used correctly. And that takes practice!