A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-170.c
1#include<stdio.h>
2intmain(void){
3intn=(int)2.5+(int)2.5;
4printf("%d\n",n);
5return0;
6}
Conversions
Answer & explanation
Console output
4
Why
Each (int)2.5 truncates to 2 before the addition, so the sum is 2 + 2 = 4. The two discarded 0.5 fractions are never added together, which is why the result is not 5. Truncation applies to each operand on its own.