public static double[] arrayAvg(double[, ] a)
double[] tempArray = new double[a.GetLength(0)];
for (int i = 0; i < a.GetLength(0); i++)
for (int j = 0; j < a.GetLength(1); j++)
double avg = sum / (a.GetLength(1));
public static void Main()
Console.WriteLine("Enter the number of students that are in your class.");
int students = int.Parse(Console.ReadLine());
string[] names = new string[students];
Console.WriteLine("Enter the names of each student.");
for (int i = 0; i < names.Length; i++)
names[i] = Console.ReadLine();
Console.WriteLine("How many grades does each student have?");
int numofgrades = int.Parse(Console.ReadLine());
double[, ] grades = new double[students, numofgrades];
for (int i = 0; i < grades.GetLength(0); i++)
Console.WriteLine("Please enter the grades for " + names[i]);
for (int j = 0; j < grades.GetLength(1); j++)
grades[i,j] = double.Parse(Console.ReadLine());
double[] classAvg = arrayAvg(grades);
Console.WriteLine("Your grade book looks like this.");
for (int i = 0; i < students; i++)
Console.Write(names[i] + ":");
for (int j = 0; j < numofgrades; j++)
Console.WriteLine(grades[i,j] + "| ");
Console.Write("Final Average: " + classAvg[i]);
Console.WriteLine("\n------------------------------------");