Here is the sum for a diagonal top-left to bottom-right:
public int sumarDiagonal()
{
int x = 0;
for (int F = 0; F < Filas; F++)
{
for (int c = 0; c < Columnas; c++)
{
if (F == c)
{
x += m[F,c];
}
}
}
return x;
}
How can I go from top-right to bottom-left?
Your original code with two nested loops is not very efficient.
Better do it like this: