Magic Square – IEEXtreme 8.0

Problem

Johnny designed a magic square (square of numbers with the same sum for all rows, columns and diagonals i.e. both the main diagonal – meaning the diagonal that leads from the top-left corner towards bottom-right corner – and the antidiagonal – meaning the diagonal that leads from top-right corner towards bottom-left corner). Write a program to test it.

Task
Write a program that will check if the given square is magic (i.e. has the same sum for all rows, columns and diagonals).

Continue reading “Magic Square – IEEXtreme 8.0”

Advertisements