using System.Collections.Generic;
static void Main(string[] args)
Console.Write("Input the rows and columns of the matrix: ");
var read = Console.ReadLine().Split(' ');
ints = new int[int.Parse(read[0]), int.Parse(read[1])];
Console.WriteLine("Invalid input. Please try again.\n");
for(int i = 0; i < ints.GetLength(0); i++)
for(int j = 0; j < ints.GetLength(1); j++)
Console.Write($"element - [{i}], [{j}]: ");
while (!int.TryParse(Console.ReadLine(), out ints[i, j])) Console.Write("Invalid input. Please try again.\n\nelement - [{i}], [{j}]: ");
Console.WriteLine("The matrix is:\n");
for (int i = 0; i < ints.GetLength(0); i++)
for (int j = 0; j < ints.GetLength(1); j++)
Console.Write(ints[i, j] + " ");
Console.WriteLine("\nThe transpose of the matrix is:\n");
for (int i = 0; i < ints.GetLength(1); i++)
for (int j = 0; j < ints.GetLength(0); j++)
Console.Write(ints[j, i] + " ");