In mathematics, the remainder of the integer division of -7/3 is +2, since -7 = (3)(-3) +2.
But why does the following code:
int r = (-7) % 3;
printf("%d",r);
prints -1? Somehow it is fooled by the fact that the remainder of the integer division 7/3 is 1, but it shouldn't be happening.