Determining the highest,lowest and average score of a set of data in C

Working on a problem,here is the code.Its actually in C.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    char name[20];
    int ID[4];
    int Quiz1, Quiz2, Quiz3, Quiz4;
    int Exam;
    float Average_score;
    FILE* spTable;
    int sum;
    
    spTable = fopen("1234.DAT","r");
    if (!spTable)
    {
     printf("Could not open file\a\n");
    }
    
    printf("\nName \tID \tQuiz1 \tQuiz2 \tQuiz3 \tQuiz4 \tExam");
while((fscanf(spTable, "%d %d %d %d %d %d", &name, &ID, &Quiz1, &Quiz2, &Quiz3,  &Quiz4, &Exam)) != EOF)
     
       printf("\n \%d \%d \%d \%d \%d", name, ID, Quiz1, Quiz2, Quiz3, Quiz4, Exam);
  
  system("PAUSE");	
  return 0;
}

I already have a file saved with the data needed. I'm trying to find the highest, lowest and average scores from the data saved. I could have done this easily by comparing each score with the other and printing the result but the data contains 50 different scores. Any hints please?
As you read the file line by line, keep track of the highest and lowest score you've seen
so far. Also, as you read the file, keep a running tally of the scores along with a counter
for the number of scores you read. When you reach the end of file, you'll then have
the highest score, lowest score, sum of all scores, and number of scores. avg = total / count.
Topic archived. No new replies allowed.