A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-32.c
1#include<stdio.h>
2intmain(void){
3intq=-7/2,r=-7%2;
4printf("%d\n",q*2+r);
5return0;
6}
Numbers
Answer & explanation
Console output
-7
Why
C guarantees the identity (a / b) * b + (a % b) == a whenever a / b is representable. Here q is -3 and r is -1, so q * 2 + r is -6 + (-1) == -7, exactly the original dividend. This identity is precisely why the remainder must be negative for a negative dividend.