commit 67483eaceb34aa173466105575bc145bf3e3c330 Author: Reina Harrington-Affine Date: Tue Jul 29 13:06:28 2025 -0700 Initial commit for KNR C exercises diff --git a/KNR C/a.out b/KNR C/a.out new file mode 100755 index 0000000..214b95d Binary files /dev/null and b/KNR C/a.out differ diff --git a/KNR C/ex1_1-tempconverter.c b/KNR C/ex1_1-tempconverter.c new file mode 100644 index 0000000..0157faf --- /dev/null +++ b/KNR C/ex1_1-tempconverter.c @@ -0,0 +1,25 @@ +#include + +/* print farenheit-celsius table + * for fahr = 0, 20, ..., 300 */ + +int main() + { + float fahr, celsius; + float lower, upper, step; + + lower = 0; /* lower bound of temp scale*/ + upper = 300; /* upper bound of temp scale*/ + step = 20; /* step size between calculated conversions*/ + + fahr = lower; + while (fahr <= upper) + { + celsius = (5.0/9.0) * (fahr-32); + printf("%3.0f\t%6.1f\n", fahr, celsius); + fahr = fahr + step; + } + return 0; + } + + diff --git a/KNR C/hello_world.c b/KNR C/hello_world.c new file mode 100644 index 0000000..ed0683f --- /dev/null +++ b/KNR C/hello_world.c @@ -0,0 +1,7 @@ +#include + +int main() + { + printf("hello, world\n"); + return 0; + } diff --git a/KNR C/hello_world.out b/KNR C/hello_world.out new file mode 100755 index 0000000..e3cbf9a Binary files /dev/null and b/KNR C/hello_world.out differ