3 Holly has written an algorithm.
| Step 1 | Input two positive integers \(A\) and \(B\) |
| Step 2 | Let \(C = A - B\) |
| Step 3 | If \(C < 0\), let \(D = B\) then let \(E = B + C\) |
| Step 4 | If \(C = 0\), jump to Step 10 |
| Step 5 | If \(C > 0\), let \(D = A\) and let \(E = B\) |
| Step 6 | Let \(F = D - E\) |
| Step 7 | If \(F < 0\), let \(D = E\) then let \(E = F + D\) and go back to Step 6 |
| Step 8 | If \(F = 0\), let \(F = D\) then jump to Step 11 |
| Step 9 | If \(F > 0\), let \(D = F\) then go back to Step 6 |
| Step 10 | Let \(F = A\) |
| Step 11 | Let \(G = A \div F\) |
| Step 12 | Let \(M = G \times B\) |
| Step 13 | Print the values \(F\) and \(M\) |
- Work through Holly's algorithm using the input values \(A = 30\) and \(B = 18\). Set out your working using the table in the answer book. Use one row for each step where any values change and only write down values when they change. Write down the values that are printed.
- Describe what happens when \(A = 18\) and \(B = 30\). You need only record enough rows of the table to be able to show what happens.
- Without doing further working, state the output values of \(F\) and \(M\) when \(A = 12\) and \(B = 8\).