C program to convert Fahrenheit to Celsius always prints zero

后端 未结 7 1008
无人及你
无人及你 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.

提交回复
热议问题