+ 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.

2 ответов

+ 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

- 1

Arithmetic operator % is used for solve modulus operator problem.