From 0d48636cdcdd5bc47e30fa6de21a1b8dcab7ec32 Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Wed, 3 Nov 2021 02:00:55 -0400 Subject: [PATCH] Add the second version formatting --- 02-vars-and-math.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/02-vars-and-math.c b/02-vars-and-math.c index c49f524..2fd0e3a 100644 --- a/02-vars-and-math.c +++ b/02-vars-and-math.c @@ -13,8 +13,8 @@ int main() fahr = lower; while (fahr <= upper) { - celsius = 5 * (fahr-32) / 9; - printf("%g\t%g\n", fahr, celsius); + celsius = (5.0/9.0) * (fahr-32.0); + printf("%3.0f %6.2f\n", fahr, celsius); fahr = fahr + step; } }