diff options
| -rw-r--r-- | src/1-4/celsius_fahrenheit.c | 14 |
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; + } +} |
