Question about the boolean character %


#1

In lesson 7 in the Conditions and Control flow, the exercise asks to place 108 % 100. What does the % mean?


#2

Modulo, or remainder.

17 / 5 = 3, 2 remainder

17 % 5 == 2

The division will return 3.4 in a calculator. To see how the decimal fraction represents the remainder, we multiply it by the divisor, 5.

0.4 * 5  ==  2

3 * 5 + 0.4 * 5  ==  15 + 2  ==  17

#3

Oh yeah! I remember now. Thank you very much.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.