Back to demo
Public demo question
Shatha’s Magical Matrix
Shatha once solved a problem that required calculating the sum of the two diagonals of a square matrix (Diagonal sums question). She considered that proble...
Shatha once solved a problem that required calculating the sum of the two diagonals of a square matrix (Diagonal sums question). She considered that problem medium-level. Now, she wants to challenge you with something a bit harder to test your problem-solving skills.
So lets go:
You are given a square matrix of size n x n where n is an odd number. Your task is to:
Calculate the sum of:
The main diagonal (top-left to bottom-right)
The secondary diagonal (top-right to bottom-left)
The middle row
The middle column
Then check whether all four sums are equal.