An algorithm is shown in the pseudocode below:
1 running ← True
2 total ← 0
3 WHILE running = True
4 n ← USERINPUT
5 IF n > 0 THEN
6 WHILE n > 0
7 rem ← n MOD 3
8 IF rem = 1 THEN
9 total ← total + 2
10 ELSE IF rem = 2 THEN
11 total ← total + 5
12 ENDIF
13 n ← n DIV 3
14 ENDWHILE
15 OUTPUT total
16 running ← False
17 ELSE
18 running ← False
19 ENDIF
20 ENDWHILE
What will be output when the user input is 22?
444
999
111111
121212
208 exam-style questions on AQA GCSE Computer Science Representing algorithms. Each one has a worked solution and a mark scheme showing where the marks go.