The following program uses a condition-controlled loop.
a = 12
b = 1
while a > 1
b = b * 2
a = a - b
endwhile
print(b)
Complete the trace table to show the values of a, b and any output at each step of the algorithm.
| a | b | output |
|---|---|---|
95 exam-style questions on OCR GCSE Computer Science Programming fundamentals. Each one has a worked solution and a mark scheme showing where the marks go.