+ 1

Modulus or remainder operator problem

I understood that this operator is not just a division, but it's for the difference between the closest divisor and the actual number (thanks to Utpal Kumar), but sadly I still can't understand what's it's purpose or why would I use them for (and hopefully some other examples of this operator) Sorry for my English.

3rd Jul 2016, 2:50 AM
MrSuperTebby
MrSuperTebby - avatar
3 Réponses
+ 2
One of the easiest applications I can think of is you can check if a number is even or odd, like you could say if(yourNum%2 != 0) { your number is odd} else {your number is even} also you could use it if you are coding some type of grid thing
3rd Jul 2016, 3:29 AM
Robert Jones
- 1
Arithmetic operator % is used for solve modulus operator problem.
5th Jan 2017, 3:34 AM
akhilesh sharma
akhilesh sharma - avatar