# Dumb programming question

**URL:** <https://forums.speedlife.net/t/dumb-programming-question/193911>\
**Category:** PittSpeed Off Topic\
**Created:** [November 29, 2007, 12:09pm UTC](https://forums.speedlife.net/t/dumb-programming-question/193911 "2007-11-29T12:09:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![imported\_Jon](https://avatars.discourse-cdn.com/v4/letter/i/edb3f5/32.png) [@imported\_Jon](https://forums.speedlife.net/u/imported_Jon)\
**Post date:** [November 29, 2007, 12:09pm UTC](https://forums.speedlife.net/t/dumb-programming-question/193911/1 "2007-11-29T12:09:05Z")

</div>

So I’m working on this retarded program for my class and I can’t figure out why it won’t come up with the right answer. It’s supposed to convert Kelvin to Fahrenheit…here’s what I have…

#include\<stdio.h\>  
#include\<conio.h\>  
int main(){  
float K, F;  
printf(“Please enter a Kelvin temperature.”);  
scanf("%f",&K);  
F=(((9/5)\*(K-273.15))+32);  
printf(“The equivalent Fahrenheit temperature is %5.2f.”,F);  
getch();  
return 0;  
}

It comes up with 300 being equal to 58.85 and it’s not, it’s supposed to be 80.33…says the teacher, and a calculator.

It’s probably a dumb mistake, but if anyone can help I’d appreciate it.

---

<div class="post-metadata">

**Author:** ![obi-1](https://avatars.discourse-cdn.com/v4/letter/o/ac8455/32.png) [@obi-1](https://forums.speedlife.net/u/obi-1)\
**Post date:** [November 29, 2007, 12:22pm UTC](https://forums.speedlife.net/t/dumb-programming-question/193911/2 "2007-11-29T12:22:15Z")

</div>

Just guessing: maybe 9 and 5 are being treated as integers, giving a 1 after the division. Try 9.0 and 5.0

---

<div class="post-metadata">

**Author:** ![imported\_Jon](https://avatars.discourse-cdn.com/v4/letter/i/edb3f5/32.png) [@imported\_Jon](https://forums.speedlife.net/u/imported_Jon)\
**Post date:** [November 29, 2007, 12:23pm UTC](https://forums.speedlife.net/t/dumb-programming-question/193911/3 "2007-11-29T12:23:28Z")

</div>

Thank you!  
I appreciate it, I went through everything I could think of but that wasn’t one of them haha.

F=(((9.0/5.0)\*(K-273.15))+32);

All I had to change!

---

<div class="post-metadata">

**Author:** ![obi-1](https://avatars.discourse-cdn.com/v4/letter/o/ac8455/32.png) [@obi-1](https://forums.speedlife.net/u/obi-1)\
**Post date:** [November 29, 2007, 12:24pm UTC](https://forums.speedlife.net/t/dumb-programming-question/193911/4 "2007-11-29T12:24:38Z")

</div>

No problem. Glad to help.
