- 1

Print (num%17)

What the % meaning

16th Jun 2021, 1:21 AM
Terminator 2.0
Terminator 2.0 - avatar
4 Respuestas
+ 4
The operator of the remainder of the number % (for example: 17 % 3 = 2) 1. Take the nearest number when divided by 3 would be zero. That's apparently 15 2. Subtract 15 from 17 and the result is your answer. I would also recommend to deal with the division modulo negative numbers for example: -2%7 -> 5 why so?
16th Jun 2021, 2:09 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
% is the modulo operator... it return the rest of whole division of left-hand-side argument by right-hand-side argument: 5%2 = 1 11%3 = 2 result is always integer in range 0 (included) to right-hand-side argument (excluded)
16th Jun 2021, 1:26 AM
visph
visph - avatar
0
often used to test divisibility of a number by right-hand-side argument: if equals 0, number is divisible by right-hand-side argument ;)
16th Jun 2021, 1:28 AM
visph
visph - avatar