c_exercises/1-3.c

18 lines
401 B
C
Raw Normal View History

2022-11-05 17:50:48 -03:00
#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 */
fahr = lower;
printf("celsius fahrenheit\n");
while (fahr <= upper) {
celsius = (5.0/9.0) * (fahr-32.0);
printf("%7.0f %10.1f\n", fahr, celsius);
fahr = fahr + step;
}
}