/* * Program to demonstrate converting Fahrenheit to Celsius. * Output: Some examples of converting Fahrenheit to Celsius. */ #include /* Convert Fahrenheit temperature f to Celsius and return */ double f_to_c(double f); /* Convert Fahrenheit temperature f to Celsius and print */ void convert_and_print(double f); /* Main program */ int main(void) { /* * in choosing input values here I tried for ones where I knew * what the output should be */ convert_and_print(32); convert_and_print(212); convert_and_print(98.6); convert_and_print(-40); return 0; } double f_to_c(double f) { return (5.0/9) * (f - 32); } void convert_and_print(double f) { printf("%lf degrees Fahrenheit is %lf degrees Celsius\n", f, f_to_c(f)); }