c_exercises/1-4.c

18 lines
413 B
C

#include <stdio.h>
int main(){
float fahr, celsius;
float lower, upper, step;
lower = 0; /* lower limit of temperature scale */
upper = 300; /* upper limit */
step = 20; /* step size */
celsius = lower;
printf("fahrenheit celsius\n");
while (celsius <= upper) {
fahr = ((9.0/5.0) * celsius)+32.0;
printf("%10.0f %7.1f\n", celsius, fahr);
celsius = celsius + step;
}
}