C: converting Farenheit to Celsius

前端 未结 3 616
我在风中等你
我在风中等你 2020-12-02 03:10
int main (void)
{
    int fahrenheit; // fahrenheit stands for fahrenheit
    double c; // c stands for celsius

    printf(\"Enter your fahrenheit, we\'ll covnvert          


        
3条回答
  •  孤城傲影
    2020-12-02 03:50

    Integer math versus floating point math.

    i = 5/9           // i is equal to 0
    d = 5.0/9.0       // d is equal to whatever 5 divided by 9 would actually be
    

    You also need to actually print the value:

    printf("Here is your %f in celsius!.\n", c);
    

提交回复
热议问题