Iclass Solution
{
public double cToF(int C)
{
//Your code here
double fh;
fh = (C*(double)(9/5))+32; //C=32 F=64
return fh;
}
}
IIclass Solution
{
public double cToF(int C)
{
//Your code here
double fh;
fh = (C*1.8)+32; //C=32 F=89
return fh;
}
}
Please take a look on the above code. This code mainly coverts temperature from Celsius to Fahrenheit. In the code I, when I used (9/5) in formula, I got the answer as 64. But in code II, when I used 1.8(9/5=1.8), I got as 89(correct one). Could anyone explain the logic behind that?