the-c-programming-language/chapter01/ex04.c (361B)
1 /* Exercise 1-4 - 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 /* Celsius values; */ 12 lower = 0; 13 upper = 50; 14 step = 2; 15 16 printf("Celsius to Fahrenheit\n\n"); 17 18 for(c = 0; c <= upper; c += step) { 19 f = (c * 9.0) / 5.0 + 32; 20 printf("%5.1f°C = %5.1f°F\n", c, f); 21 } 22 23 return 0; 24 }