What are floor division and modulo operators | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What are floor division and modulo operators

31st Aug 2019, 11:01 AM
Aryan Raj
Aryan Raj - avatar
2 Answers
+ 5
Floor division(x//y) returns the quotien in which the digits after the decimal point are removed. Ex:- 10 // 3 3 (output) # 3.333 rounds towards zero 10 // -3 -4 (output) # -3.333 rounds away from zero 9 // 2 4 (output) # 4.5 rounds towards zero 9 // -2 -5(output) # -4.5 rounds away from zero Modulo(x%y) returns the remainder . Ex: 10%3 1(output) 10/3 ,quotien =3 and remainder=1 15%4 3(output) 15/4 ,quotien =3 and remainder=3
31st Aug 2019, 11:38 AM
Prathvi
Prathvi - avatar
+ 1
Thank you so much sir.
31st Aug 2019, 2:09 PM
Aryan Raj
Aryan Raj - avatar