From 43fcdf7034cb05de506eb4b52accb12e4dd8ce07 Mon Sep 17 00:00:00 2001 From: celso Date: Sat, 5 Nov 2022 17:50:48 -0300 Subject: [PATCH] third exercise --- 1-3.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 1-3.c diff --git a/1-3.c b/1-3.c new file mode 100644 index 0000000..9abe581 --- /dev/null +++ b/1-3.c @@ -0,0 +1,17 @@ +#include +int main(){ + float fahr, celsius; + float lower, upper, step; + + lower = 0; /* lower limit of temperature scale */ + upper = 300; /* upper limit */ + step = 20; /* step size */ + + fahr = lower; + printf("celsius fahrenheit\n"); + while (fahr <= upper) { + celsius = (5.0/9.0) * (fahr-32.0); + printf("%7.0f %10.1f\n", fahr, celsius); + fahr = fahr + step; + } +}