ProgrammingHard

On an n x n grid with n = 4, how many cells lie on at least one of the two main diagonals?

  1. A. 6
  2. B. 8
  3. C. 7
  4. D. 16

Correct answer: B. 8

The diagonals have 4 cells each and share none when n is even, so 4 + 4 = 8 cells.

More C Programming questions

Exams that ask this topic