A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-2.c
1#include<stdio.h>
2intmain(void){
3inta=7,b=2;
4doubler=(double)a/b;
5printf("%.2f\n",r);
6return0;
7}
Conversions
Answer & explanation
Console output
3.50
Why
Casting a to double makes the division floating point: the int b is then promoted to double as well, so 7.0 / 2.0 gives 3.5. Converting just one operand before the division is the standard way to avoid integer truncation. The result prints as 3.50.