Hello, I'm beginning C programming and am having a little problem with this program of mine. The program is to take entered temperatures, which it does correctly, average them, also does correctly, then covert them to Celsius and then average those...which it does not to correctly...yet I cannot grasp the issue with my code. Any thoughts?
Code:
#include <stdio.h>
int main (void)
{
double fah1, fah2, fah3, fah4, fah5;
double cel1, cel2, cel3, cel4, cel5;
printf ("Please enter the first temperature in degrees fahrenheit -> ");
scanf ("%lf", &fah1);
printf ("Please enter the second temperature in degrees fahrenheit -> ");
scanf ("%lf", &fah2);
printf ("Please enter the third temperature in degrees fahrenheit -> ");
scanf ("%lf", &fah3);
printf ("Please enter the fourth temperature in degrees fahrenheit -> ");
scanf ("%lf", &fah4);
printf ("Please enter the fifth temperature in degrees fahrenheit -> ");
scanf ("%lf", &fah5);
printf ("The five temperatures (in degrees fahrenheit) that you entered are -> %.1lf %.1lf %.1lf %.1lf %.1lf\n\n", fah1, fah2, fah3, fah4, fah5);
printf ("The average of the five temperatures (in degrees fahrenheit) is -> %.lf\n\n", (fah1 + fah2 + fah3 + fah4 + fah5) / 5);
printf ("The first temperature entered in degrees Celsius is -> %.1lf\n", cel1=(fah1 - 32) * (5 / 9));
printf ("The second temperature entered in degrees Celsius is -> %.1lf\n", cel2=(fah2 - 32) * (5 / 9));
printf ("The third temperature entered in degrees Celsius is -> %.1lf\n", cel3=(fah3 - 32) * (5 / 9));
printf ("The fourth temperature entered in degrees Celsius is -> %.1lf\n", cel4=(fah4 - 32) * (5 / 9));
printf ("The fifth temperature entered in degrees Celsius is -> %.1lf\n", cel5=(fah5 - 32) * (5 / 9));
printf ("The five temperatures in degrees Celsius are -> %.1lf %.1lf %.1lf %.1lf %.1lf\n\n", cel1, cel2, cel3, cel4, cel5);
printf ("The average of the five temperatures in degrees Celsius is -> %.1lf\n\n", (cel1 + cel2 + cel3 + cel4 + cel5) / 5);
return 0;
}
The program runs fine with the exception of a myriad of 0's where there should not be.
Thank you