Totalling in a loop (7a)
A running total: set Total to 0 before the loop, then add each Value to Total on every repeat. Output Total after the loop ends.
Understanding Totalling in a loop (7a) in IGCSE Computer Science Paper 2
What it does: Each repeat reads one INPUT value and adds it to Total, so totalling happens inside the loop body. OUTPUT Total comes after NEXT Count, so it shows the complete total once, not on every repeat. 0 + 4 = 4, then 4 + 6 = 10, then 10 + 10 = 20. The total holds the sum of all the values, not just the last one. Total ← 0 must be placed before the loop so the running total builds up across all repeats.
Common mistakes: A running total must start at 0. Starting at 1 makes the final total 1 too big. It should be Total ← 0. The input must be stored in Value. Typing into Total overwrites the running total each time. It should be INPUT Value.
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 47–57) and word search (Modules 47–70).
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 →