From 39c0cbcc70aff47e17107826aa76cb525c83b122 Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Tue, 9 Jul 2019 16:00:48 -0400 Subject: ch2 --- ftoc.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 ftoc.c (limited to 'ftoc.c') diff --git a/ftoc.c b/ftoc.c deleted file mode 100644 index 70b994a..0000000 --- a/ftoc.c +++ /dev/null @@ -1,37 +0,0 @@ -#include - -#define LOWER 0 // lower limit of table -#define UPPER 300 // upper limit of table -#define STEP 20 // step size - -float ftoc(int fahr); - -/* - * Print Fahrenheit-Celcius table for fahr = 0, 20, ... 300. - */ -main() { - float fahr, celcius; - int lower, upper, step; - - lower = LOWER; // lower limit of temperature table - upper = UPPER; // upper limit of temperature table - step = STEP; // step size - - fahr = lower; - - printf("%3s %6s\n", "F", "C"); - - // while (fahr <= upper) { - // celcius = 5.0 / 9.0 * (fahr - 32.0); - // printf("%3.0f %6.1f\n", fahr, celcius); - // fahr = fahr + step; - // } - - for (fahr = UPPER; fahr >= LOWER; fahr = fahr - STEP) { - printf("%3.0f %6.1f\n", fahr, ftoc(fahr)); - } -} - -float ftoc(int fahr) { - return (5.0 / 9.0) * (fahr - 32); -} -- cgit v1.2.3