0

can someone explain to me , and give me clear examples how modulus works ?

19th Sep 2016, 5:26 PM
Greg Arsua
Greg Arsua - avatar
3 odpowiedzi
0
What happens is that when you use the modulus operator is for example 10% 3 the remainder is 1 because it divideds 9 by 3 offscreen and then what it shows how much there's left until 10 wich is 1.I don't know how correct that is mathematically or how easy it is to understand, but I hope this answer helps out.
19th Sep 2016, 6:14 PM
Robi486
Robi486 - avatar
0
The modulus operator returns the remainder when a number is divided by another. Most important point to note is that it works for only integers. So, for example 5%2 will return 1. This is because 5 is not completely divisible by 2 but the highest number that is divisible by 2 and less than 5 is 4. So the remainder is 1 that is (5-4). Consider another example : 18%5. Now 18 is not divisible by 5 but the highest number divisible by 5 that is less than 18 is 15. So remainder = 3 that is (18-15).
19th Sep 2016, 7:43 PM
Mohammed Maaz
Mohammed Maaz - avatar
0
when you see modulos just think of it as a remainder. like division in math.
22nd Sep 2016, 2:49 PM
Maloi Trust