Computer Science · May / June 2024 · Paper 21 · Question 4
2210
As printed in the paper
The question as text
This pseudocode algorithm is intended to allow, at random, between 1 and 20 values to be entered and totalled. The total and average of the entered values are output at the end of the algorithm. 01 DECLARE Loop : STRING 02 DECLARE Limit : INTEGER 03 DECLARE Value : REAL 04 DECLARE Total : REAL 05 Total 0 06 Limit ROUND(RANDOM() * 19,0) + 1 07 IF Loop 1 TO Limit 08 OUTPUT "Enter a number" 09 INPUT Loop 10 Total Total * Value 11 NEXT Loop 12 OUTPUT "The total of the numbers entered is ", Total 13 OUTPUT "The average of the numbers entered is ", Total / Limit
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
4(a)[4]
4(b)[2]
4(c)[4]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

