From 3fab99fcf9975412fc1a2bdd21bbcfa9a8e113b7 Mon Sep 17 00:00:00 2001 From: Cian Bagshaw Date: Sun, 4 Dec 2022 11:02:40 +0000 Subject: [PATCH] Added exercise 1-5 --- 1/5.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 1/5.c diff --git a/1/5.c b/1/5.c new file mode 100644 index 0000000..eb28376 --- /dev/null +++ b/1/5.c @@ -0,0 +1,14 @@ +/* + Exercise 1-5. Modify the temperature conversion program to print the table in + reverse order, that is, from 300 degrees to 0. + === +*/ + +#include + +int main () { + float fahr; + for (fahr=300; fahr>=0; fahr-=20) { + printf("%3.0f %6.1f\n", fahr, (5.0/9.0) * (fahr-32.0)); + } +} -- 2.20.1