I can't seem to figure this out. How can I use a for loop to accomplish the following?

Code:classAverage[0] = (stuArray[0].grade[0] + stuArray[1].grade[0] + stuArray[2].grade[0] + stuArray[3].grade[0])/4; classAverage[1] = (stuArray[0].grade[1] + stuArray[1].grade[1] + stuArray[2].grade[1] + stuArray[3].grade[1])/4; classAverage[2] = (stuArray[0].grade[2] + stuArray[1].grade[2] + stuArray[2].grade[2] + stuArray[3].grade[2])/4; classAverage[3] = (stuArray[0].average + stuArray[1].average + stuArray[2].average + stuArray[3].average)/4;