Your task is to, given a square of positive integers, determine if the square is a magic square. A magic square is one where the sum of the numbers in each row, column and both diagonals are the same.
As an example, consider the following square:
4 9 2
3 5 7
8 1 6This is a magic square, as the sum of every row, column and both diagonals is equal to 15.
Your task is to, given a square of positive integers, determine if the square is a magic square. A magic square is one where the sum of the numbers in each row, column and both diagonals are the same.
As an example, consider the following square:
4 9 2
3 5 7
8 1 6This is a magic square, as the sum of every row, column and both diagonals is equal to 15.