Worked solution from the Programming Paper 2 Algorithms, Programming and Logic booklet, Part 1 of 3.
Use REPEAT ... UNTIL (or WHILE) with your own counter.
Count ← 1
REPEAT
OUTPUT "Please enter a name"
INPUT Name
Names[Count] ← Name
Count ← Count + 1
UNTIL Count > 10Count set to 1 before the loop [1]
A condition-controlled loop (REPEAT ... UNTIL or WHILE ... ENDWHILE) that runs 10 times, with its end keyword [1]
Count increased by 1 inside the loop [1]
Rest of the algorithm (OUTPUT, INPUT, store in Names[Count]) correct [1]
A WHILE Count <= 10 DO ... ENDWHILE loop is also accepted.
▶ Topic lesson
A lesson on this topic · by Mr Bulmer's Learning Zone. Tap the picture to open it on YouTube.
Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.