In many programming languages, the modulus, represented by a percentage sign, does the following:
1 % 3 = 1
2 % 3 = 2
3 % 3 = 0
4 % 3 = 1
5 % 3 = 2
6 % 3 = 0
7 % 3 = 1
8 % 3 = 2
9 % 3 = 0
10 % 3 = 1
The value left of the modulus is divided by the value right of the modulus sign, and what remains after dividing is the result of the statement. In secondary school math in Holland, we used to do the 'staartdeling' and, as I learned, I also had to write down what remained after the division:
3 / 10 \ 3
9
--
1 is the result of the modulus
or:
3 / 124 \ 41
12
--
04
3
--
1 is the result of the modulus
Geen opmerkingen:
Een reactie posten