#include <stdio.h>
int
main (void)
{
int a, b, c, d;/* a few operations */
a = 10 % 3;
b = -10 % 3;
c = 10 % -3;
d = -10 % -3;
/* you need to double the % to display on screen */
printf ("10 %% 3 is %d\n", a);
printf ("-10 %% 3 is %d\n", b);
printf ("10 %% -3 is %d\n", c);
printf ("-10 %% -3 is %d\n", d);
return (0);
}
10 % 3 is 1
-10 % 3 is -1
10 % -3 is 1
-10 % -3 is -1