Answer the question
In order to leave comments, you need to log in
"theTemperature* = 5/9" what is the difference between "theTemperature= theTemperature* 5/9"?
The bottom line is that when I write "theTemperature* = 5/9" it returns 0 for any value of the argument, and when I wrote "theTemperature= theTemperature* 5/9" - everything worked.
Answer the question
In order to leave comments, you need to log in
The difference is in the order of calculations.
int t = 20;
t = t * 5 / 9;
t *= 5 / 9;
theTemperature *= 5/9
So you multiply theTemperature
by the result of the integer division of 5 by 9.
Therefore, it will always be 0. 5 / 9
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question