ProgrammingModerate

What is the total number of elements in a triangle of rows 1 to 10, where row k has k elements?

  1. A. 55
  2. B. 45
  3. C. 100
  4. D. 66

Correct answer: A. 55

Rows 1..10 hold 1 + 2 + ... + 10 = n(n + 1)/2 = 10 x 11 / 2 = 55 elements. 45 stops at row 9, 100 treats the triangle as a full 10 x 10 square, and 66 sums up to 11.

More C Programming questions

Exams that ask this topic