From 4e7e47dd94de953b642178a6cdd0e36b6f1434ee Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Sat, 30 Nov 2024 15:53:33 -0500 Subject: [PATCH] Doing a cc4e --- cc4e/fc.c | 19 +++++++++++++++++++ cc4e/hello.c | 5 +++++ 2 files changed, 24 insertions(+) create mode 100644 cc4e/fc.c create mode 100644 cc4e/hello.c diff --git a/cc4e/fc.c b/cc4e/fc.c new file mode 100644 index 0000000..ede2d3f --- /dev/null +++ b/cc4e/fc.c @@ -0,0 +1,19 @@ +#include + +/* print Fahrenheit-Celsius table +for f = 0, 20, ..., 300 */ + +int main() { + int lower, upper, step; + float fahr, celsius; + lower = 0; /* lower limit of temperature table */ + upper = 300; /* upper limit */ + step = 20; /* step size */ + fahr = lower; + + while (fahr <= upper) { + celsius = (5.0/9.0) * (fahr-32.0); + printf("%4.0f %6.1f\n", fahr, celsius); + fahr = fahr + step; + } +} diff --git a/cc4e/hello.c b/cc4e/hello.c new file mode 100644 index 0000000..340ac02 --- /dev/null +++ b/cc4e/hello.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("hello, world\n"); + return 0; +}