Follow a repeated instruction
Trace a loop by keeping a clear record of changing values.
Supplied materials
- Pseudocode means instructions expressed in readable words; no software is required.
- Supplied rule: set total to 1. Repeat exactly 3 times: add 2 to total. After all repetitions, show total.
Learn the idea
A loop repeats a stated set of instructions. The starting value is set before the loop; each repetition uses the value left by the previous one.
A trace table records the state after each step. It helps distinguish the number of repetitions from the amount added. Showing the answer after the loop is different from resetting the total inside it.
- Make columns named repetition and total.
- Record total = 1 before any repetition.
- Add 2 once for each of the three repetitions.
- Change the repeat count to four and trace it again.
See the method in action
Before the loop total is 1. After repetitions 1, 2 and 3 it is 3, 5 and 7. The shown answer is 7; the loop added 2 three times.
Check your reasoning
Your answer is temporary and is not saved to an account. Download your current answer before leaving or reloading. Written work on paper or in another app stays in your own file.
See the answer and explanation
9
The trace is 1 → 3 → 5 → 7 → 9. Four additions of 2 contribute 8, and the starting 1 is still included.
Take it further
Move “set total to 1” inside the loop, just before “add 2.” Explain why the final value then becomes 3.
Nothing here is saved to an account or sent to a teacher. The answer download includes your current choice and any checked feedback.
Longer courses for learners ages 14+
These related courses have their own preparation and projects. They are not early-grade assignments.
Check the subject sources
These LifeStarter passages, scenarios and exercises are authored for this Academy with AI assistance and review. External resources keep their publishers’ terms. A grade label suggests a starting level; it does not establish alignment with your school’s complete requirements.