Online worksheet ยท 4 of 4
The condition must eventually change - Online practice 4
Read the information, then answer the questions. An adult may read the instructions aloud. Show your working where asked.
Read before answering
Paper loop: initialise count = 0; while count < 6, update count = count + 2, then print(count). Retest the condition before each next iteration. A strict less-than boundary need not be reached exactly if the step skips over it. Do not run the deliberately broken no-update version.
Worksheet preview
- List outputs and the final count for start 0, limit 6, step 2.
- How many times does this loop body execute? Why does it stop?
- If the update is removed, will the loop necessarily terminate from start 0 with condition count < 6?
This exercise is included in the free preview. Register free to complete it and download the preview PDFs. No payment is required.
Already registered? Sign in