Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

fix the errors in this program to make it run here the link for the code: http:/

ID: 3544916 • Letter: F

Question

fix the errors in this program to make it run

here the link for the code:


http://ideone.com/PKNiKX

Write a program to read in a set of daily high temperatures (in degree s Fahrenheit) from the file, temps. in, one temperature at a time, until EOF is reached. Your program should compute the average and minimum temperatures over the set of data, count the total number of days, and count the number of days over 95 degree s. Suppose file. in contains the temperatures: 87.1 85.5 92.2 96.9 101.0 90.4 83.1 89.6 Then the formatted output on the screen should be: Number of days: 8 Average temp: 90.7 Minimum temp: 83.1 Days over 95: 2

Explanation / Answer

#include<stdio.h>
int main(void)
{
double temp;
double min;
double sum = 0;
int days = 0;
int days95 = 0;
int status;
FILE* inp;
inp = fopen("file.in","r");
status = fscanf(inp,"%lf",&temp);
while(status!=EOF)
{
sum+=temp;
days++;
if(temp>95)
days95++;
if(days==1)
min = temp;
if(temp<min)
min = temp;
status = fscanf(inp,"%lf",&temp);
}
printf("Number of days :%d ",days);
printf("Average temp: %.1f ",sum/days);
printf("Minimum temp: %.1f ",min);
printf("Days over 95: %d ",days95);
fclose(inp);
return 0;
}