/* * Print a table of Fahrenheit temperatures and their Celsius equivalents (floating point) * From K&R 2nd ed., 1-2 */ #include int main (void) { float fahr, celsius; float lower, upper, step; lower = 0; // Lower limit of temperature scale upper = 300; // Upper limit of temperature scale step = 20; // Step size fahr = lower; printf("FAHRENHEIT TO CELSIUS TABLE\n"); while (fahr <= upper) { celsius = (5.0/9.0) * (fahr-32.0); printf("%3.0f %6.5f\n", fahr, celsius); fahr = fahr + step; } return 0; }