#include <stdio.h>
main()
{
int fahrenheit, celsius;
int lower, upper, step;
lower = 0;
upper = 200;
step = 5;
fahrenheit = lower;
printf("\n");
printf("Fahrenheit \t Celsius \n");
printf("---------- \t ------- \n");
while (fahrenheit <= upper)
{
celsius = 5 * (fahrenheit - 32)/9;
printf(" %d \t\t %d \n", fahrenheit, celsius);
fahrenheit = fahrenheit + step;
}
}
Execution
Fahrenheit Celsius
---------- -------
0 -17
5 -15
10 -12
15 -9
20 -6
25 -3
30 -1
35 1
40 4
45 7
50 10
55 12
60 15
65 18
70 21
75 23
80 26
85 29
90 32
95 35
100 37
105 40
110 43
115 46
120 48
125 51
130 54
135 57
140 60
145 62
150 65
155 68
160 71
165 73
170 76
175 79
180 82
185 85
190 87
195 90
200 93
No comments:
Post a Comment