Question: c# Modify to return the average score of each student using System; public class StudentScoreMulti { static void Main( ) { int [ , ]student
c# Modify to return the average score of each student using System; public class StudentScoreMulti { static void Main( ) { int [ , ]student = {{52, 76, 65}, {98, 87, 93}, {43, 77, 62}, {72, 73, 74}}; // scores double sum; // sum of the scores for each student for (int i = 0; i < student.GetLength(0); i++) { sum = 0; for (int j = 0; j < student.GetLength(1); j++) sum += student[i, j]; Console.Write ("The average score for student {0} is ", i ); Console.WriteLine ((sum/student.GetLength(1)).ToString("F1")); } } }
use for test:
public static void DoEx7_11()
{
int[,] student =
{{52, 76, 65},{98, 87, 93},{43, 77, 62},{72, 73, 74}};
Ex7_11 s = new Ex7_11(student);
double[] averages = new double[student.GetLength(0)];
for (int i = 0; i < student.GetLength(0); i++)
averages[i] = s.computeAverage(i);
s.Display(averages);
Console.ReadLine();
Console.Clear();
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
