blob: c5eb2420a75f40f50ada2d963724b87287822747 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include <stdio.h>
/* Prints a conversion table from celsius to fahrenheit */
int main(int argc, char *argv[]) {
float celsius, fahr;
int lower, upper, step;
lower = 0;
upper = 300;
step = 20;
celsius = lower;
printf("celsius\tfahrenheit\n");
while (celsius <= upper) {
fahr = (celsius * 9.0 / 5.0) + 32.0;
printf("%7.0f\t%10.1f\n", celsius, fahr);
celsius = celsius + step;
}
return 0;
}
|