Can sb tell me y 7℅(5//2)=1? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can sb tell me y 7℅(5//2)=1?

idu it

6th Jul 2018, 8:34 AM
MiGeNa HoXhA
MiGeNa HoXhA - avatar
3 Answers
+ 2
// means integer division therefore, since 5/2 = 2.5 we have 5//2 = 2 % is modulo operator, giving us the remainder of a division since we have 7%2 it is 1
6th Jul 2018, 8:42 AM
Matthias
Matthias - avatar
+ 2
thank u 😊
6th Jul 2018, 8:53 AM
MiGeNa HoXhA
MiGeNa HoXhA - avatar
+ 1
// is the floor division operator. It returns the quotient. 5/2 = 2.5 => 5//2 = 2. % is the modulo operator. It returns the remainder of a division. 7/2 = 3*2 + 1. The remainder here is 1.
6th Jul 2018, 8:43 AM
Hoàng Nguyễn Văn
Hoàng Nguyễn Văn - avatar