I just started my first programming class and was given a program and need to fix part of it to work. All it does is convert celsius to farenheit. I've narrowed it down to one line.
This is how the line is written on his program:
tempCentigrade = 5/9 * (tempFahrenheit - 32);
If I change it to:
tempCentigrade = (tempFahrenheit - 32) * 5/9;
The program works as it should. When I put data into the original program I keep getting -0.0 as the result.
I'm just wondering why it needs to be this way.
Thanks
This is how the line is written on his program:
tempCentigrade = 5/9 * (tempFahrenheit - 32);
If I change it to:
tempCentigrade = (tempFahrenheit - 32) * 5/9;
The program works as it should. When I put data into the original program I keep getting -0.0 as the result.
I'm just wondering why it needs to be this way.
Thanks