8 A student is tracing the following algorithm with positive integer values of \(A\) and \(B\).
The function INT gives the integer part of a number, eg INT(2.3) \(= 2\) and \(\operatorname { INT } ( 3.8 ) = 3\).
| Line 10 | Let \(X = 0\) |
| Line 20 | Input \(A , B\) |
| Line 30 | If \(\operatorname { INT } ( A / 2 ) = A / 2\) then go to Line 50 |
| Line 40 | Let \(X = X + B\) |
| Line 50 | If \(A = 1\) then go to Line 90 |
| Line 60 | Let \(A = \operatorname { INT } ( A / 2 )\) |
| Line 70 | Let \(B = 2 \times B\) |
| Line 80 | Go to Line 30 |
| Line 90 | Print \(X\) |
| Line 100 | End |
- Trace the algorithm in the case where the input values are \(A = 20\) and \(B = 8\).
- State the purpose of the algorithm.
- Another student changed Line 50 to
Line 50 If \(A = 1\) then go to Line 80
Explain what would happen if this algorithm were traced.
\includegraphics[max width=\textwidth, alt={}]{d1e453d6-0abb-4a7e-87c1-28275074dd08-17_2486_1714_221_153}