Good evening, I managed to add the left-right diagonal, that is, from position 0,0, but I have not managed to add the diagonal from right to left in an example of a 3 x 3 matrix. The code that I am going to show it's just the sum of the diagonal, please can you advise me how to add the other diagonal. Grace.
Console.WriteLine("sumadiagonal de izuierda a derecha");
for (j = 0; j < matriz.GetLength(0); j++)
{
for (i = 0; i < matriz.GetLength(1); i++)
{
if (i == j)
{
sumadiagonal1 += matriz[i, j];
}
}
}
Console.WriteLine("La suma de la diagonal 1 es =" + sumadiagonal1);