A loop repeats steps; a condition (if–otherwise) chooses which step to do. Tracing a loop means tracking the values round by round.
| Count from a to b in steps of s | (last number said − a) ÷ s + 1 |
| x = a, repeat k times: x = x + d | x = a + k × d |
| x = a, repeat k times: x = x × 2 | x = a × 2ᵏ |
| Repeat a times (repeat b times: clap) | a × b claps |
| Turn for a regular shape with n sides | 360° ÷ n (square: 90°, hexagon: 60°) |
| While the box has less than ₹T, add ₹d | stop at the first total of ₹T or more |
(a) Start with n = 18.
While n is 84 or less: say n, then add 4 to n.
How many numbers are said?
(b) Isha's box has ₹30.
While the box has less than ₹745: add ₹50 and count one day.
How many days are counted?
Working: (a) 18, 22, …, 82: (82 − 18) ÷ 4 + 1 = 17; (b) ₹30 + 15 × ₹50 = ₹780, which is the first total of ₹745 or more
Answer: (a) 17; (b) 15