What is floor division and modulo? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is floor division and modulo?

31st Oct 2017, 1:46 PM
Mayank
Mayank - avatar
2 Answers
+ 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
31st Oct 2017, 1:50 PM
Given
Given - avatar
+ 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
31st Oct 2017, 2:23 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar