]>
zdv2.bktei.com Git - BK-2023-05.git/blob - src/kr_exercises/ch1/s1.2/c_to_f_float.c
1 /* Desc: simple temperature converter
2 * Usage: ./s1..c_to_f_float.c
3 * Ref/Attrib: The C Programming Language, 2nd Edition, Section 1.2
9 /* print Celsius-Fahrenheit table for celsius = -50, -40, ..., 100 */
13 int lower
, upper
, step
;
15 lower
= -50; /* lower limit of temperature table */
16 upper
= 100; /* upper limit */
17 step
= 5; /* step size */
21 while (celsius
<= upper
){
22 fahr
= (celsius
* (9.0 / 5.0)) + 32.0;
23 printf("%3.0f,%7.2f\n", celsius
, fahr
);
24 celsius
= celsius
+ step
;
28 printf("\n\nDone\n\n");
36 * Author: Steven Baltakatei Sandoval