main() { int fahr; for (fahr = 0; fahr <= 300; fahr = fahr + 20) { printf("%3d %6.1d\n", fahr, to_celsius(fahr)); } }
int main() { float fahr, celsius; float lower, upper, step; lower = 0; /* lower limit of temperature scale */ upper = 300; /* upper limit */ step = 20; /* step size */ fahr = lower; while (fahr <= upper) { celsius = to_celsius(fahr); printf("%3.0f %6.1f\n", fahr, celsius); fahr = fahr + step; } }
int main() { float fahr; float lower, upper, step; lower = 0; upper = 300; step = 20; fahr = lower; printf("fahrenheit celcius\n"); while (fahr <= upper) { printf("%10.0f %8.1f\n", fahr, to_celsius(fahr)); fahr = fahr + step; } }