third exercise

This commit is contained in:
celso 2022-11-05 17:50:48 -03:00
parent 4fd0182e6c
commit 43fcdf7034
1 changed files with 17 additions and 0 deletions

17
1-3.c Normal file
View File

@ -0,0 +1,17 @@
#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;
}
}