Worked solution from the Algorithm Design and Problem-solving Paper 2 Problem-solving and Programming booklet, Part 2 of 2.
Draw the flowchart as follows. After START:
Set Count to 0 before the loop, then in the loop INPUT NextNum [1]
Decision Is NextNum < 0 ? : on YES go to the output box OUTPUT "Number of primes: ", Count (a message plus the count), then END [1]
On NO: a function call box Set Answer to IsPrime(NextNum) [1]
Decision Is Answer = TRUE ? : on YES Set Count to Count + 1; both YES and NO then go back to INPUT NextNum [1]
▶ Whole paper
Video solution of the whole paper · by Awab Aqib. 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.