Calculate the average score of class In this part you will c

Calculate the average score of class
In this part, you will calculate the average score of the students. The average score is calculated by taking the sum of all the scores of the students and dividing it by the number of students.

float getAverageScore (float scores[], int size) The getAverageScore()
function will take two arguments, i.e. the reference of your scores array and the size of the array. The function should return the average score of the students which should be of float type.

Solution

HI, Please find the implemention of reuired method.

Please let me know in case of any issue.

float getAverageScore (float scores[], int size){
  

   float sum = 0; // initializing sum with 0

   for(int i=0; i<size; i++){

       sum = sum + scores[i];
   }

   float avg = sum/size;

   return avg;
}

Calculate the average score of class In this part, you will calculate the average score of the students. The average score is calculated by taking the sum of al

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site