ProgrammingModerate

A 5 x 5 grid is stored as an int matrix. Which expression gives the number of cells on its main diagonal?

  1. A. 4
  2. B. 10
  3. C. 25
  4. D. 5

Correct answer: D. 5

The main diagonal cells are (i, i) for i from 0 to 4, so there are five of them.

More C Programming questions

Exams that ask this topic