1 % 2 == 12 % 2 == 0-2 % 2 == 0-1 % 2 == -1
Here, -1%2
does not results in 1. Hence, it will not increment value of negodd
variable.
In JAVA
, negative number modulo will give same result as positive number modulo but with a negative sign. 0 is neutral thus it will not have any sign.