ProgrammingEasyTCS NQT · Infosys · Accenture

What will be the output of the following pseudocode?

What will be the output of the following pseudocode?
Integer s = 0
for (each i from 1 to 5)
    s = s + i * i
end for
Print s
  1. A. 15
  2. B. 55
  3. C. 30
  4. D. 45

Correct answer: B. 55

1 + 4 + 9 + 16 + 25 = 55. 15 would be the sum of i alone.

More Pseudocode and Code Tracing questions

Exams that ask this topic