What is output by this algorithm?
Total ← 0
FOR Count ← 1 TO 4
Total ← Total + Count * Count
NEXT Count
OUTPUT Total
- The loop runs four times, with Count = 1, 2, 3 and 4.
- Count * Count gives 1, 4, 9 and 16.
- Total after each pass: 0 + 1 = 1, 1 + 4 = 5, 5 + 9 = 14, 14 + 16 = 30.
Answer: 30