+ 3
Javascript learn
Can someone explain me better how modulus works? or I'm so stupid that I don't understand it
4 Answers
+ 20
25 % 3... First do 25 / 3. you will get something around 8.3 . Then 8 * 3 = 24, you multiply the integer with the number that the original has been divided to. Then you take away 24 from 25, so that will leave 1. So basically, modulus gives the remainder of a division
+ 10
It gives you the remainder of the inerger division, for example 5%2 : as 5/2 is 2 because it doesn't have decimals, 2*2=4 so the remainder is 1. So 5%2=1, same thinking would apply for all, like 9%4=5 for ex
+ 9
you see how many times it fits inside the number and the rest it's the answer
+ 8
9%4=1