diff options
| author | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-11-14 17:41:36 +0800 |
|---|---|---|
| committer | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-11-14 17:41:36 +0800 |
| commit | d95a93c2269819710e89deb6850c596c7e32c663 (patch) | |
| tree | 5f3048012c0a829eb76ce21759a2e90ae46074cd | |
| parent | face4050aa9617b6e93d11f92a5059f48716dc6b (diff) | |
| download | k&r-exercises-d95a93c2269819710e89deb6850c596c7e32c663.tar.gz | |
1.3
| -rw-r--r-- | 1/1.c | 7 | ||||
| -rw-r--r-- | 1/2.c | 7 | ||||
| -rw-r--r-- | 1/3.c | 21 |
3 files changed, 27 insertions, 8 deletions
@@ -1,7 +1,6 @@ #include <stdio.h> -int main(int argc, char *argv[]) -{ - printf("hello, world\n"); - return 0; +int main(int argc, char *argv[]) { + printf("hello, world\n"); + return 0; } @@ -1,7 +1,6 @@ #include <stdio.h> -int main(int argc, char *argv[]) -{ - printf("hello \c world\n"); - return 0; +int main(int argc, char *argv[]) { + printf("hello \c world\n"); + return 0; } @@ -0,0 +1,21 @@ +#include <stdio.h> + +int main(int argc, char *argv[]) { + float fahr, celsius; + int lower, upper, step; + + lower = 0; + upper = 300; + step = 20; + fahr = lower; + + printf("fahr\tcelsius\n"); + + while (fahr <= upper) { + celsius = (5.0 / 9.0) * (fahr - 32.0); + printf("%4.0f\t%7.1f\n", fahr, celsius); + fahr = fahr + step; + } + + return 0; +}
\ No newline at end of file |
