summaryrefslogtreecommitdiffstats
path: root/1/5.c
diff options
context:
space:
mode:
authorSadeep Madurange <smadurange@users.noreply.github.com>2021-11-16 18:58:27 +0800
committerSadeep Madurange <smadurange@users.noreply.github.com>2021-11-16 18:58:27 +0800
commitcd68f56367811e1234a5584addb7752e1de43599 (patch)
tree1bd504be68bb2dbdcf6a2086bac5c2d02e71d6ab /1/5.c
parent9d0f759d15f2879e1b28c1c80bea7a244e7483cb (diff)
downloadk&r-exercises-cd68f56367811e1234a5584addb7752e1de43599.tar.gz
1.5
Diffstat (limited to '1/5.c')
-rw-r--r--1/5.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/1/5.c b/1/5.c
new file mode 100644
index 0000000..fcaeb8e
--- /dev/null
+++ b/1/5.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+/* Prints a conversion table from fahrenheit to celsius in reverse order */
+
+int main(int argc, char *argv[]) {
+ int fahr;
+
+ for (fahr = 300; fahr >= 0; fahr = fahr - 20)
+ printf("%3d %6.1f\n", fahr, (5.0 / 9.0) * (fahr - 32));
+
+ return 0;
+} \ No newline at end of file