+ 1

I don't why the answer is not print in float value. the output only prints an integer value. Pls reply what is error.

https://code.sololearn.com/cdn1VhS5BHAI/?ref=app And my second question is that i tried this code to convert temperatures. If there any better codes to do the this same thing. Share that code to me

14th Jan 2021, 4:27 PM
Jawahirullah
Jawahirullah - avatar
3 Respostas
0
The integer results are happening because the variables and literal constants in the calculations are all integer. If even one of the constants is given a decimal point then it will do the calculations in floating point. Try it like this: F=((temp*9./5)+32); C=(temp-32.)*5/9;
14th Jan 2021, 5:04 PM
Brian
Brian - avatar
14th Jan 2021, 5:05 PM
Atul [Inactive]
0
You can do like this too
14th Jan 2021, 5:05 PM
Atul [Inactive]