]> zdv2.bktei.com Git - BK-2023-05.git/blob - src/kr_exercises/ch1/s1.4/temp_convert_symbolic_constant.c
update(src/kr):Finish section 1.5.1
[BK-2023-05.git] / src / kr_exercises / ch1 / s1.4 / temp_convert_symbolic_constant.c
1 /* Desc: Prints Fahrenheit-Celsius table; uses symbolic constants
2 * Usage: name=temp_convert; gcc -o "$name" "$name".c; ./"$name";
3 * Ref/Attrib: [0]: The C Programming Language, 2nd Edition, Section 1.4
4 */
5 #include <stdio.h>
6
7 # define LOWER 0 /* Lower limit of table. */
8 # define UPPER 300 /* Upper limit of table. */
9 # define STEP 20 /* Step size. */
10
11 /* Print Fahrenheit–Celsius table */
12
13 int main(){
14 int fahr;
15 for (fahr = LOWER; fahr <= UPPER; fahr = fahr + STEP)
16 printf("%3d %6.1f\n", fahr, (5.0/9.0)*(fahr - 32) );
17 return 0;
18 };
19
20 /* Author: Steven Baltakatei Sandoval
21 * License: GPLv3+
22 */