summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--1/15.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/1/15.c b/1/15.c
new file mode 100644
index 0000000..3499ec7
--- /dev/null
+++ b/1/15.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+/* converts fahrenhite to celsius */
+int ftoc(int fahr);
+
+int main(int argc, char *argv[]) {
+ int fahr, celsius;
+ int lower, upper, step;
+
+ lower = 0;
+ upper = 300;
+ step = 20;
+ fahr = lower;
+
+ while (fahr <= upper) {
+ printf("%d\t%d\n", fahr, ftoc(fahr));
+ fahr += step;
+ }
+
+ return 0;
+}
+
+int ftoc(int fahr) { return 5 * (fahr - 32) / 9; } \ No newline at end of file