Modulo | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

Modulo

1.25 % 0.5 = 0.25 How is that possible?

24th Jul 2020, 11:49 AM
Joy
4 Respuestas
+ 1
The modulo will subtract 20 by 6 until a fractional or decimal value is reached. This means it gives you the remainder of division between 20 and 6. 20 - 6 = 14, 14 - 6 = 8, 8 - 6 = 2, and 2 - 6 < 0, so your answer is 2
24th Jul 2020, 11:53 AM
Pete Cowling
Pete Cowling - avatar
+ 1
Joy % will give you remainder There's a formula : Dividend = Quotient* Divisor + Remainder 1.25 = 0.5* 2 + remainder Remainder = 1.25 - 1.00 = 0.25
24th Jul 2020, 1:34 PM
David
0
Returns remainder after dividing .if not divisible then it returns the number itself.
24th Jul 2020, 1:58 PM
shubham kumar
shubham kumar - avatar