public int diagX()
{
int x;
x = 0;
for (f = 1; f <= filas; f++)
{
for (c = columnas; c >= 1; c--)
{
if (f > c || f < c)
{
x += a[f, c];
}
else
{
continue;
}
}
}
return x;
}
for example this code :
if you have
1 , 2
3 , 6
and you want to across diag you must take a[2, 1] you will get 2.
and at the looping you ve give continue on the else because after get value 2.
it will be a[2, 2] because f == c as false then you break not come back to first loop. why f==c is false because if you want search across diag of matrix you cant get value from f == c. for example:
if matrix above we loop but can equals f and c. we can get:
(a[2, 1] = 2) + (a[2, 2] = 6) = 8 nah! you can see the big false at this code.