My other diagonal method won't work correctly.
public int sumOtherDiag()
{
int otherDiag = 0;
for (int i = 0; i < square.length−1; i++)
{
otherDiag += square[i][i];
}
return otherDiag;
}
I don't have my output to show here, but is there anything that someone sees wrong right off the bat?
This method is supposed to add the elements and get the sum of the second diagonal (starting from the right - down) of a magic square. For example, if my square was
01 04 03
03 05 04
05 02 04
It would output
03 + 05 + 05 = and get 13
But my actual output is printing a number less than what it is supposed too.
(It's hard to explain without my output. I will upload that later when I get access to my program)
Any help will be greatly appreciated, thank you!