summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-02-09 18:02:05 -0700
committermo khan <mo@mokhan.ca>2014-02-09 18:02:05 -0700
commit897c33aa70c5b74e227542b920db72822931e816 (patch)
treec0d3fa51849a91389b4fffdb54facdefebc7ea09
parent7d0d1de8117c51ba032cffe496bbbb122d008423 (diff)
complete 1-4. convert celsius to fahrenheit
-rw-r--r--src/1-4/celsius_fahrenheit.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/1-4/celsius_fahrenheit.c b/src/1-4/celsius_fahrenheit.c
new file mode 100644
index 0000000..8dce305
--- /dev/null
+++ b/src/1-4/celsius_fahrenheit.c
@@ -0,0 +1,14 @@
+#include "stdio.h"
+
+int main()
+{
+ int upper = 100;
+ float celsius = -40, fahrenheit;
+
+ printf("Celsius Fahrenheit\n");
+ while (celsius <= upper) {
+ fahrenheit = ((celsius * 9.0)/5.0) + 32;
+ printf("%7.0f %10.2f\n", celsius, fahrenheit);
+ celsius += 1;
+ }
+}