This is what I've adjusted it to, except the final specification of the assignment is that I must incorporate the implementation and function call of the function MAX and the function MIN. I'm having trouble doing so, if anyone could lend a helping hand I would greatly appreciate it.
Thanks for all your help!
int num, min, max, sum, count, first;
sensor = fopen("C:\\Users\\joseph.labelle\\Documents\\data.txt", "r");
if (sensor != NULL)
for (sum = count = first = 0;
fscanf(sensor, "%d", &num) == 1; sum += num, ++count)
min = max = num; first = 1;
else if (num > max) max = num;
else if (num < min) min = num;
printf("count = %d, min = %d, max = %d, sum = %d, avg = %.1lf\n",
count, min, max, sum, sum / (double) count);
printf("Unable to read file 'C:\\Users\\joseph.labelle\\Documents\\data.txt'.\n" );