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
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;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.