the-c-programming-language/chapter01/ex03.c (363B)
1 /* Exercise 1-3 - prints a table with degrees conversion */ 2 3 #include <stdio.h> 4 5 6 int main (void) 7 { 8 int lower, upper, step; 9 float c, f; 10 11 /* Fahrenheit values; */ 12 lower = 0; 13 upper = 100; 14 step = 5; 15 16 printf("Fahrenheit to Celsius\n\n"); 17 18 for(f = 0; f <= upper; f += step) { 19 c = ((f - 32) * 5) / 9; 20 printf("%5.1f°F = %5.1f°C\n", f, c); 21 } 22 23 return 0; 24 }