Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions

Question

* What is the importance of soil testing in civil engineering?

Answered: 1 week ago

Question

Explain the concept of shear force and bending moment in beams.

Answered: 1 week ago