Answer:
double average(double* scores, int size)
{ double sum = 0;
for (int i = 0; i < size; i++)
sum += scores[i];
return sum / size; }
Step-by-step explanation:
Above is the function defined and its explanation is as follows:
double average(double* scores, int size)
- A variable average with data type double having two arguments scores(array of doubles having scores) and size(number of elements of array scores).
double sum = 0;
for (int i = 0; i < size; i++)
sum += scores[i];
- All the scores in the array are added into a variable named sum with data type double.
return sum / size;
- Return value will give the average of all the scores calculated by dividing sum of all the scores with size(total number) of scores.