A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-49.c
1#include<stdio.h>
2intmain(void){
3doubled=5;
4d=d/2;
5intn=d;
6printf("%d %.1f\n",n,d);
7return0;
8}
Conversions
Answer & explanation
Console output
2 2.5
Why
Since d is a double, d / 2 is floating-point division giving 2.5, which d keeps. Copying d into the int n truncates toward zero to 2, while d itself still prints as 2.5. The same value yields different results depending on whether it lives in a double or an int.