C program to convert Fahrenheit to Celsius always prints zero

后端 未结 7 983
无人及你
无人及你 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 08:07

    You problem is here :

    celsius = (5/9) * (fahrenheit-32);
    

    5/9 will always give you 0. Use (5.0/9.0) instead.

    0 讨论(0)
提交回复
热议问题