0
What is floor division and modulo?
2 Réponses
+ 2
An operator placed between two numbers, to get the remainder of the division of those numbers - Modulus
Example:
24/13 = 1.867........
24//13 = 1
// - is floor division it will give integer value
+ 9
Floor division (//) returns the *next lower* integer:
14 // 3 = 4
14 // -3 = -5
-14 // 3 = -5
-14 // -3 = 4
Modulo (%) returns the remainder of the floor division:
14 % 3 = 2
14 % -3 = -1
-14 % 3 = 1
-14 % -3 = -2