Double calculation always result in 32.00000 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Double calculation always result in 32.00000

I was trying to convert Centrigrade Temperatures into Fahrenheit. The formula is tempc *(9.0/5.0)+32 Tempc is a double value. But whatever I put in for tempc the result is always the same, namely 32 because the multiplication part evaluates to 0. Why? Any help?

15th Nov 2016, 5:51 AM
Arsal Ali
Arsal Ali - avatar
2 Answers
+ 1
I'm getting the right answer : #include <iostream> using namespace std; int main() { double temp = 37 *(9.0/5.0)+32; cout<<temp; return 0; }
15th Nov 2016, 8:16 AM
Rahul Chittimalla
Rahul Chittimalla - avatar
0
Well that's strange
15th Nov 2016, 9:51 AM
Arsal Ali
Arsal Ali - avatar