18 lines
401 B
C
18 lines
401 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 */
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
}
|