A skipping contest: the counts of n people are in scores (at least 1). The average avg is already worked out. Write the rest of above_average(scores, n): go through the array again and count the people above the average (equal does not count).
above_average({60, 80, 100}, 3)→1above_average({70, 70}, 2)→0int above_average(int scores[], int n)int above_average(int scores[], int n) {
int sum = 0;
for (int i = 0; i < n; i++) {
sum += scores[i];
}
double avg = (double)sum / n;
int count = 0;
// your code here: another loop: if above avg, add 1 to count
return count;
}
Run tries the examples. When they look right, Submit.