From d95a93c2269819710e89deb6850c596c7e32c663 Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Sun, 14 Nov 2021 17:41:36 +0800 Subject: 1.3 --- 1/3.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 1/3.c (limited to '1/3.c') diff --git a/1/3.c b/1/3.c new file mode 100644 index 0000000..802e1c0 --- /dev/null +++ b/1/3.c @@ -0,0 +1,21 @@ +#include + +int main(int argc, char *argv[]) { + float fahr, celsius; + int lower, upper, step; + + lower = 0; + upper = 300; + step = 20; + fahr = lower; + + printf("fahr\tcelsius\n"); + + while (fahr <= upper) { + celsius = (5.0 / 9.0) * (fahr - 32.0); + printf("%4.0f\t%7.1f\n", fahr, celsius); + fahr = fahr + step; + } + + return 0; +} \ No newline at end of file -- cgit v1.2.3