Trace a Repeat with a Counter
Record a variable’s value after each repetition.
Supplied materials
- Paper and a pencil, or say your answers aloud.
Learn the idea
A variable stores a value that an algorithm can change. A trace records the value at each step. Writing a trace helps prevent skipped steps and makes a result easier to check.
Use this paper algorithm: “Set count to 0. Repeat three times: add 2 to count. Show count.” The initial value is zero. Each repeat uses the value from the previous repeat, so the sequence of values is 0, 2, 4, 6.
- Draw a table with rows Start, Repeat 1, Repeat 2, and Repeat 3.
- Write 0 in Start, then add 2 in each following row.
- Read the final row as the shown result.
- For the check, reset the value to 1 and use four repeats instead.
See the method in action
Starting at 0 and adding 2 three times gives 0 → 2 → 4 → 6. The shown result is 6; the initial value is not an extra repetition.
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
Trace all four additions: 1 → 3 → 5 → 7 → 9. There are four repetitions after the starting value, so the final count is 9.
Take it further
Keep four repeats but start at 0. The trace is 0 → 2 → 4 → 6 → 8. Compare the new result with the original 9 and explain the one-unit difference.
Nothing here is saved to an account or sent to a teacher. The answer download includes your current choice and any checked feedback.
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.