Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
oorrja
GitHub Repository: oorrja/learntosolveit
Path: blob/master/languages/cprogs/Ex_1.5_reverse.c
1240 views
1
/***
2
*
3
* Temperature Conversion Program, Celsius to Fahrenheit!
4
*
5
* print Fahrenheit-Celsius table for fahr = 0,20 ... 300
6
*
7
***/
8
9
#include <stdio.h>
10
11
int main(void)
12
{
13
float fahr, celsius;
14
int lower, upper, step;
15
16
lower = 0;
17
upper = 300;
18
step = 20;
19
20
printf("C F\n\n");
21
celsius = upper;
22
23
while(celsius >= lower)
24
{
25
fahr = (float) ((9.0 / 5.0) * celsius + 32.0);
26
printf("%3.0f %6.1f\n", celsius, fahr);
27
celsius = celsius - step;
28
}
29
30
return 0;
31
}
32
33