July 5th, 2013, 04:02 AM
You left out the main function. Every C program requires a main function.
You should realize by now that C is case-sensitive, which means that if you change the case of any character in a variable, type, or function name, then that is a different identifier. Therefore, Main is something entirely different from main.
celsius = 5 * (fahr-32) / 9;
will not do what you think it does. You are expecting it to perform floating-point division, but since both the dividend and divisor are integers it will perform integer division instead.
5.0/9.0 = 0.55555556
5/9 = 0
Changing your expression to dividing by 9.0 should be enough to invoke floating-point division. But then you'll be assigning a double to an int which will raise a warning about losing accuracy. You can truncate the result by casting it to int, or you could round off by adding 0.5 before you cast it to int.
Last edited by dwise1_aol : July 5th, 2013 at 04:09 AM.