Totalling in Cambridge pseudocode
Adds each new Number to the running Total every time the loop repeats. Set Total ← 0 before the loop so the total starts from zero.
Understanding Totalling in Cambridge pseudocode in IGCSE Computer Science Paper 2
What it does: DECLARE names the variable Total and gives it the INTEGER data type so it can store whole-number sums. The FOR loop visits each array position in turn and adds that element to Total, so every mark is included. A declared variable has no guaranteed starting value in pseudocode. You must initialise Total to 0 yourself so the running total starts from zero. Total goes 0, then 4, then 11, then 20. The final total is the sum of all the values: 4 + 7 + 9 = 20. 9 would be the last value only, which is what happens if you write Total ← Number.
Common mistakes: A FOR loop uses TO to give its end value, not UNTIL. It should be FOR Count ← 1 TO 5. A DECLARE statement needs a colon between the variable name and its data type. It should be DECLARE Total : INTEGER.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 275–285) and word search (Modules 275–295).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
Total ← Total + NumberFill in the Blanks
Spot the Error
Student with a class code? Join your class →