learningc/chapters/1/exercises/4.c

18 lines
359 B
C
Raw Normal View History

#include <stdio.h>
int main() {
float fahr, celsius, lower, upper, step;
lower = -40;
upper = 300;
step = 20;
celsius = lower;
printf("%s", "Temperature conversion table (C to F):\n");
while (celsius <= upper) {
fahr = celsius * (9.0/5.0) + 32.0;
printf("%3.0f %6.1f\n", celsius, fahr);
celsius = celsius + step;
}
return 0;
}