Console.Write("Input the number of rows: ");
int rows = Convert.ToInt32(Console.ReadLine());
Console.Write("Input the number of columns: ");
int cols = Convert.ToInt32(Console.ReadLine());
int[,] matrix = new int[rows, cols];
Console.WriteLine("\nInput elements in the matrix:");
for (int i = 0; i < rows; i++)
for (int j = 0; j < cols; j++)
Console.Write($"element - [{i}],[{j}] : ");
matrix[i, j] = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("\nThe matrix is:");
for (int i = 0; i < rows; i++)
for (int j = 0; j < cols; j++)
Console.Write(matrix[i, j] + " ");
int[,] transpose = new int[cols, rows];
for (int i = 0; i < rows; i++)
for (int j = 0; j < cols; j++)
transpose[j, i] = matrix[i, j];
Console.WriteLine("\nThe Transpose of the matrix is:");
for (int i = 0; i < cols; i++)
for (int j = 0; j < rows; j++)
Console.Write(transpose[i, j] + " ");