Solved

I want to convert fahrenheit to celsius but when i execute it the answer is weird

#include <stdio.h>

main()
{
int fh;
int cel;
fh = 200;
cel = 5.0 * (fh-32) / 9.0;
printf("your celsius degree is %lf\n", cel);
}

that is my code
1 answer Last reply Best Answer
More about convert fahrenheit celsius execute answer weird
  1. Best answer
    well "cel" is declared integer. Try with float.

    #include <stdio.h>

    main()
    {
    int fh;
    float cel;
    fh = 200;
    cel = 5.0 * (fh-32) / 9.0;
    printf("your celsius degree is %lf\n", cel);
    }

    seems to be working fine

    http://www.compileonline.com/compile_c_online.php
Ask a new question

Read More

Celsius Apps