Commit 897c33a

mo khan <mo@mokhan.ca>
2014-02-10 01:02:05
complete 1-4. convert celsius to fahrenheit
1 parent 7d0d1de
Changed files (1)
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;
+  }
+}