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

What is Modulo % ??

10th Aug 2020, 2:06 PM
Anirudha Gurav
Anirudha Gurav - avatar
2 Answers
10th Aug 2020, 2:08 PM
Pranav Kalro
Pranav Kalro - avatar
+ 1
its remainder division. Say 12%5 or 12mod5 is 12 divided by 5 in terms of how how many 5’s go into 12. that would be 2, and your remainder would be 2 as well. so 12%5 = (5+5) + 2 = 2. Also in situations where the number you’re dividing is less than the divisor then your answer would just be that number. I.e. 4%7 = 4. and lastly if the divisor is a factor of the divended or the same value your Anders would be Zero. For example, 10%5 or 10%10 both equal zero (no remainder)
10th Aug 2020, 2:17 PM
Roderick Davis
Roderick Davis - avatar