Explain Modulo | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Explain Modulo

I want to know what is modulo. its says it's a %. but it doesn't act like a %. i need to understand the math of it too. can u explain it for me. that will really help me.

4th Apr 2018, 5:54 PM
Afraim Ahmed
Afraim Ahmed - avatar
4 Answers
+ 2
It is the rest from division. For example: 14 % 3 = 2 because 14 / 3 = 4 * 3 + 2 5 % 2 = 1 because 5 / 2 = 2 * 2 + 1
4th Apr 2018, 5:58 PM
Bartosz Pieszko
Bartosz Pieszko - avatar
+ 1
The remainder of 10 when divided by 3 is 1. So, 10 % 3 = 1 This explains that the modulus is actually just the reminder of some division.
4th Apr 2018, 5:59 PM
Bebida Roja
Bebida Roja - avatar
+ 1
Euclid division
4th Apr 2018, 6:00 PM
Chalza
Chalza - avatar
0
so then when i using a modulo in the code which one will be the result. here is a math like- 200X26% = 52 when i will do it in the code it will show me the result 52. right..
4th Apr 2018, 6:05 PM
Afraim Ahmed
Afraim Ahmed - avatar