3 Antworten
+ 4
num is a variable like x
num % x is equal to 17 % 3.
The nearest multiple of 3 from 17 and smaller than 17 is 15, so the remainder of the division of 17 by 3 is 17-15 so 2
+ 1
% = modulo which basically is "how much will be left over after the nearest Full multiplication with 3 that results less than 17"
5*3 = 15
17-15=2
if you did it with 18 it would be 0 since 6*3 = 18
if you did for example 10%6
6*1 = 6
10-6=4
or you could think it with division since multiplication and division walk hand in hand
0
А на русском?