From 60d36096f05ed4cbe6c4296c9f1bc7213115543c Mon Sep 17 00:00:00 2001 From: celso Date: Sat, 5 Nov 2022 17:51:03 -0300 Subject: [PATCH] fourth exercise --- 1-4.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 1-4.c diff --git a/1-4.c b/1-4.c new file mode 100644 index 0000000..7f533f9 --- /dev/null +++ b/1-4.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 */ + + celsius = lower; + printf("fahrenheit celsius\n"); + while (celsius <= upper) { + fahr = ((9.0/5.0) * celsius)+32.0; + printf("%10.0f %7.1f\n", celsius, fahr); + celsius = celsius + step; + } +}