Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div2 B

What is the sum of floor(i / 2) for i = 1 to 10?

  1. A. 26
  2. B. 25
  3. C. 27
  4. D. 29

Correct answer: B. 25

Pairs of consecutive i share the same floor value, so the sum is 0 + 1 + 1 + 2 + 2 + 3 + 3 + 4 + 4 + 5 = 25.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic