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("How many students do you have?");
int students = int.Parse(Console.ReadLine());
string[] names = new string[students];
Console.WriteLine("Type your students names, pressing enter after each one.");
for(int i = 0; i< names.Length; i++)
{ names[i] = Console.ReadLine();
Console.WriteLine("How many grades for each student?");
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:");
double[]myavg = arrayAvg(grades);
for(int i = 0; i<students;i++)
Console.WriteLine(names[i] + ".");
for(int j = 0; i<numofgrades; j++)
Console.Write(grades[i,j] + "| ");
Console.Write(" Final Average " + myavg[i]);
Console.WriteLine("\n____________________________________________");