Output of nested FOR loops

In the pseudocode below, FOR k ← a TO b runs its body once for each whole number k from a to b, including both a and b.


Plain text
total ← 0
FOR i ← 1 TO 4
    FOR j ← 1 TO i
        total ← total + j
    END FOR
END FOR
OUTPUT total


Trace the pseudocode and state the value that is output, as a whole number.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Flowcharts Questions: