0

How come when you do "1.25%0.5" it give you 0.25 as the remainder but normally when you try "1.25 ÷0.5" it give you 2.5?

It's kind of confusing and I really need help

6th Nov 2019, 2:37 PM
Chukwudi Nathan Nwaokocha
Chukwudi Nathan Nwaokocha - avatar
3 Respuestas
+ 3
Floor division and modulo work as a team. Floor division finds out, how many cookies you and your friends get. Modulo finds out how many cookies will be left over. cookies = 23 friends = 3 share = cookies // friends cookies_left = cookies % friends Everyone's share will be 7. 2 cookies will be left. With float, it is basically the same: 0.5 fits two times into 1.25, and 0.25 will be left over.
6th Nov 2019, 6:50 PM
HonFu
HonFu - avatar
0
It's really easy. Look at this: https://code.sololearn.com/cZNhTMAUw2Qg/?ref=app
6th Nov 2019, 2:49 PM
Asman-H
Asman-H - avatar
0
% gives you remainder and / gives you quotient.
6th Nov 2019, 2:59 PM
Avinesh
Avinesh - avatar