using System; using System.Collections; using System.Linq; using System.Text; namespace csharp { class chapter2 { static void Main(string[] args) { int[,] grades = new int[,] {{1, 82, 74, 89, 100}, {2, 93, 96, 85, 86}, {3, 83, 72, 95, 89}, {4, 91, 98, 79, 88}}; int last_grade = grades.GetUpperBound(1); double average = 0.0; int total; int last_student = grades.GetUpperBound(0); for (int row = 0; row <= last_student; row++) { total = 0; for (int col = 0; col <= last_grade; col++) { total += grades[row,col]; } average = total / last_grade; Console.WriteLine("Average: " + average); } Console.ReadKey(); } } }