blob: e38bdf46ed6b3617b3aa354e42cea7ac92309d2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include <stdio.h>
int ftoc(int lower, int upper, int step);
/* print Fahrenheit-Celsius table */
int main()
{
ftoc(0, 300, 20);
return 0;
}
/* ftoc: print Farenheit-Celsius table */
int ftoc(int lower, int upper, int step)
{
float fahr, celsius;
fahr = lower;
while (fahr <= upper) {
celsius = (5.0/9.0) * (fahr-32.0);
printf("%3.0f %6.1f\n", fahr, celsius);
fahr = fahr + step;
}
return 0;
}
|