Answer:
C++ snippet is given below with appropriate comments and explanation
Step-by-step explanation:
Code snippet:
double average=0;//declaring variable
//using for loop
for(int i=0;i<grades.length;i++)
{
average+=grades[i];//add each grade to average
}
average/=grades.length;//find average
Explanation :
Above code snippet need a for loop to add each grade from the array to the variable average,
average/=grades.length; this will compute average.