An algorithm processes daily rainfall measurements stored in an array.
2 # Daily Rainfall
3 SET daysCount TO 0
4 SET totalRain TO 0
5 SET averageRain TO 0
6
7 FOR EACH reading FROM rainfallArray DO
8 SET daysCount TO daysCount + 1
9 SET totalRain TO totalRain + reading
10 SEND totalRain TO DISPLAY
11 END FOREACH
12
13 SET averageRain TO totalRain DIV daysCount
14 SEND averageRain TO DISPLAY
State the process being carried out at line 7 of the algorithm.
Practise Edexcel GCSE Computer Science Constructs with exam-style questions for GCSE Computer Science. 61 questions covering Structural components of programs and Writing programs with control constructs, matched to the Edexcel GCSE Computer Science (1CP2) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.