C program to convert Fahrenheit to Celsius always prints zero

后端 未结 7 1009
无人及你
无人及你 2020-11-22 07:09

I need some help with a program for converting Fahrenheit to Celsius in C. My code looks like this

#include 
int main(void)
{
    int fahrenhe         


        
7条回答
  •  臣服心动
    2020-11-22 07:45

    5 and 9 are of int type
    hence 5/9 will always result 0.

    You can use 5/9.0 or 5.0/9 or 5.0/9.0

    You can also check C program for converting Fahrenheit into Celsius

提交回复
热议问题