C Notes1
C behaves in a confusing way when one or both of the operands to % are negative. In fact, different implementations of C can behave differently in such cases. If you rely on one particular behavior, you might be surprised if you move your program to another computer. To ensure that your programs will work the same way on all machines, you should avoid using % with negative operands