fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a=-1, b=7;
  5. for (int k = 0; k < 3; ++k)
  6. printf("%d = %d, %d = %d\n", (a+k*b)/b, (a/b)+k, (-a)/b, -(a/b));
  7. printf("%d, %d\n", a % b, (b + (a % b)) % b);
  8. }
  9.  
Success #stdin #stdout 0s 10320KB
stdin
Standard input is empty
stdout
0 = 0, 0 = 0
0 = 1, 0 = 0
1 = 2, 0 = 0
-1, 6