public static void Main()
int n, m, f = 0, c = 0, sumadiagonal = 0;
Console.WriteLine("Ingresa el numero de filas: ");
f = int.Parse(Console.ReadLine());
Console.WriteLine("Ingresa el numero de Columnas: ");
c = int.Parse(Console.ReadLine());
Random aleatorio = new Random();
int[,] matriz=new int [f, c];
for (n = 0; n < matriz.GetLength(0); n++)
for (m = 0; m < matriz.GetLength(1); m++)
matriz[n, m] = aleatorio.Next(0, 10);
Console.WriteLine("MATRIZ");
for (n = 0; n < matriz.GetLength(0); n++)
for (m = 0; m < matriz.GetLength(1); m++)
Console.Write(matriz[n,m].ToString()+" ");
Console.WriteLine("Diagonal");
for (n = 0; n < matriz.GetLength(0); n++)
for (m = 0; m < matriz.GetLength(1); m++)
Console.Write(matriz[n, m].ToString()+" ");
Console.WriteLine("La suma de la diagonal es: ");
for (m = 0; m < matriz.GetLength(0); m++)
for (m = 0; m < matriz.GetLength(1); m++)
Console.Write(matriz[n, m].ToString() + " ");