Totalling in pseudocode
Totalling builds a running total. Set Total ← 0 before the loop, add each Value to Total inside the loop, then OUTPUT Total after the loop has finished.
Understanding Totalling in pseudocode in IGCSE Computer Science Paper 2
What it does: Each pass of the loop reads one input and adds it to Total, which is the totalling pattern with inputs. A running total must start at 0 before the loop. Total ← Total + Value belongs inside the loop. The total is only complete once every value has been added, so OUTPUT Total goes after ENDWHILE, NEXT or UNTIL. Adding Marks[Index] to Total builds the running total. Assigning Marks[Index] alone replaces the total each time. Pseudocode uses ← for assignment. A single = is used for comparison, so it is wrong here. Totalling always starts by setting the total variable to 0 before any values are added.
Common mistakes: A running total must start at 0. Starting at 1 makes every answer 1 too big. It should be Total ← 0. This replaces Total each time instead of adding to it. It should be Total ← Total + Mark[N].
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 242–253) and word search (Modules 232–253).
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 + ValueFill in the Blanks
Spot the Error
Student with a class code? Join your class →