#include <stdio.h>
main()
{
int fahrenheit, celsius;
int lower, upper, step;
lower = 0;
upper = 200;
step = 5;
celsius = lower;
printf("\n");
printf("Celsius \t Fahrenheit \n");
printf("------- \t ---------- \n");
while (celsius <= upper)
{
fahrenheit = (celsius * 9/5) + 32;
printf(" %d \t\t %d \n", celsius, fahrenheit);
celsius = celsius + step;
}
}
Execution
Celsius Fahrenheit
------- ----------
0 32
5 41
10 50
15 59
20 68
25 77
30 86
35 95
40 104
45 113
50 122
55 131
60 140
65 149
70 158
75 167
80 176
85 185
90 194
95 203
100 212
105 221
110 230
115 239
120 248
125 257
130 266
135 275
140 284
145 293
150 302
155 311
160 320
165 329
170 338
175 347
180 356
185 365
190 374
195 383
200 392
No comments:
Post a Comment