diff --git a/KNR C/ex1_1-tempconverter.c b/KNR C/ex1_1-tempconverter.c index 03d7958..bdbf090 100644 --- a/KNR C/ex1_1-tempconverter.c +++ b/KNR C/ex1_1-tempconverter.c @@ -5,7 +5,7 @@ int main() { - float fahr, celsius; + float fahr; float lower, upper, step; lower = 0; /* lower bound of temp scale*/ @@ -18,11 +18,9 @@ int main() printf("Temperature conversion table with 20-degree^f steps. \n"); printf("%4s\t%6s\n", "DegF", "DegC"); - while (fahr <= upper) + for (fahr = lower; fahr <=300; fahr = fahr + step) { - celsius = (5.0/9.0) * (fahr-32); - printf("%4.0f\t%6.1f\n", fahr, celsius); - fahr = fahr + step; + printf("%4.0f\t%6.1f\n", fahr, (5.0/9.0)*(fahr-32)); } return 0; } diff --git a/KNR C/ex1_1.out b/KNR C/ex1_1.out new file mode 100755 index 0000000..fd99a67 Binary files /dev/null and b/KNR C/ex1_1.out differ