Nevermind man... I just figured out the problem. I changed the initial values of the booleans:
boolean magic = false;
boolean rows = false;
boolean columns = true;...
Type: Posts; User: Guillaume_96
Nevermind man... I just figured out the problem. I changed the initial values of the booleans:
boolean magic = false;
boolean rows = false;
boolean columns = true;...
No, because the array I tested the code on is a magic square. I initialized the booleans = false, and it prints it's not a magic square though. If I initialize them = true, then it prints it's magic...
I had to initialize the boolean variables. That's why I set them to true. Now I set them all to false and it prints it's not a magic square...
I just fixed the post! :)
Hi everyone.
I'm creating a method to check if a array is Magic Square or not.
* Magic Square is a 2D array in which the sum of all rows, columns and diagonals are equal, for example:
4|9|2...