public static void Main()
string[,] seats = new string[5, 6];
seats[3, 4] = "Amitesh,J";
Console.WriteLine("Seating Arrangement:");
for (int row = 0; row < seats.GetLength(0); row++)
for (int col = 0; col < seats.GetLength(1); col++)
if (seats[row, col] != null)
Console.Write(seats[row, col] + "\t");
Console.Write("Empty\t");
int totalSeats = seats.GetLength(0) * seats.GetLength(1);
int totalStudents = CountStudents(seats);
Console.WriteLine("\nClassroom Capacity: " + totalSeats + " seats");
Console.WriteLine("\nTotal Students Present: " + totalStudents);
int[] groupCounts = CountGroups(seats);
string[] groupLabels = { "F", "S", "J", "R" };
for (int i = 0; i < groupCounts.Length; i++)
double percentage = (double)groupCounts[i] / totalStudents * 100;
Console.WriteLine("\nTotal " + groupLabels[i] + " Students: " + groupCounts[i] + ", Percentage: " + percentage.ToString("F2") + "%");
static int CountStudents(string[,] seats)
foreach (string seat in seats)
if (!string.IsNullOrEmpty(seat))
static int[] CountGroups(string[,] seats)
int[] groupCounts = new int[4];
foreach (string seat in seats)
if (!string.IsNullOrEmpty(seat))
string[] parts = seat.Split(',');
string yearCode = parts[1];