ProgrammingVery hard

int a[3][3] = {{2,7,6},{9,5,1},{4,3,8}}; Are all of the row sums, column sums and both diagonal sums equal to 15?

  1. A. No, the first row sums to 15 but the diagonals do not
  2. B. No, the columns do not all sum to 15
  3. C. Yes, it is a magic square
  4. D. No, the rows sum to 15 but the main diagonal is 14

Correct answer: C. Yes, it is a magic square

The rows, columns and both diagonals of this matrix each add to 15, so it is a magic square.

More C Programming questions

Exams that ask this topic