Question: #include int main() { FILE *fp; int temp, count = 0, sum = 0; int low, high; int days = 10; // total number of

#include

int main() {

FILE *fp;

int temp, count = 0, sum = 0;

int low, high;

int days = 10; // total number of days in the file

// open the file in read only mode 'r'

fp = fopen("Temperatures.txt", "r");

// get temperature range from user

scanf("%d %d", &low, &high);

// iterate through the file and count and add the number of days that fall within the range

while (fscanf(fp, " %d", &temp) == 1) {

if (temp >= low && temp <= high) {

count++;

sum += temp;

}

}

// close the file

fclose(fp);

// print the result

if (count > 0) {

printf("%d days had a temperature between %d and %d ", count, low, high);

printf("The mean temperature between %d and %d is %.1f ", low, high, (float) sum / count);

} else {

printf("0 days had a temperature between %d and %d ", low, high);

printf("The mean value was not calculated, since there are zero days in the range ");

}

return 0;

}

Answer this question only: How do I fix it from saying 65.0 to 65.6 and 59.0 to 59.5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!