Question 3.15:
Why does the code
double degC, degF;
degC = 5 / 9 * (degF - 32);
keep giving me 0?
Would the following rearrangement solve the problem?
degC = 5 * (degF - 32) / 9;
Topi Linkala
--
"The whole problem with the world is that fools and fanatics are
always so certain of themselves, but wiser people so full of doubts."
- Bertrand Russell
"How come he didn't put 'I think' at the end of it?" - Anonymous
Why does the code
double degC, degF;
degC = 5 / 9 * (degF - 32);
keep giving me 0?
Would the following rearrangement solve the problem?
degC = 5 * (degF - 32) / 9;
Topi Linkala
--
"The whole problem with the world is that fools and fanatics are
always so certain of themselves, but wiser people so full of doubts."
- Bertrand Russell
"How come he didn't put 'I think' at the end of it?" - Anonymous
Comment