Datei: p3-3.c
1 /* 2 * p3-3.c 3 * Beispielprogramm 3, Abschnitt 3 4 * Umwandlung von Fahrenheit in Celsius 5 * fuer f = 0, 20, ..., 300 6 */ 7 8 void main(void) 9 { 10 int lower, upper, step; 11 float fahr, celsius; 12 13 lower = 0; /* untere Grenze der Temperaturtabelle */ 14 upper = 300; /* obere Grenze */ 15 step = 20; /* Schrittweite */ 16 fahr = lower; 17 18 while (fahr <= upper) { 19 celsius = (5.0/9.0) * (fahr-32.0); 20 printf("%4.0f %6.1f\n", fahr, celsius); 21 fahr = fahr + step; 22 } 23 24 } /* main() */
Erzeugt von c2html 1.01 |