Tuesday, July 14, 2009

How to write code in C program for converting Celsius to Fahrenheit?

Does any one knows the c program code to convert celsius to Fahrenheit? Can you please type in the code as the answer. Thanks in advance.

How to write code in C program for converting Celsius to Fahrenheit?
#include%26lt;stdio.h%26gt;





float C2F(float c) {return (c*1.8)+32;}





main() {


float celsius, fanrenheit;





// 30C = 86F, check


celsius = 30;


fanrenheit = C2F(celsius);


printf("%2f",fanrenheit);


}
Reply:double convert(double celsius) {


double fahrenheit;


fahrenheit = celsius + 32 * 5/9;


return fahrenheit;


}
Reply:This is a stock standard intro program.





If you don't know how to do it (and haven't the internet skills to search for it outside of here) you need to tell your teacher because either they are a bad teacher or you are doing the wrong course.


///


No comments:

Post a Comment