OCR D1 2013 June — Question 3

Exam BoardOCR
ModuleD1 (Decision Mathematics 1)
Year2013
SessionJune
TopicFixed Point Iteration

3 Holly has written an algorithm.
Step 1Input two positive integers \(A\) and \(B\)
Step 2Let \(C = A - B\)
Step 3If \(C < 0\), let \(D = B\) then let \(E = B + C\)
Step 4If \(C = 0\), jump to Step 10
Step 5If \(C > 0\), let \(D = A\) and let \(E = B\)
Step 6Let \(F = D - E\)
Step 7If \(F < 0\), let \(D = E\) then let \(E = F + D\) and go back to Step 6
Step 8If \(F = 0\), let \(F = D\) then jump to Step 11
Step 9If \(F > 0\), let \(D = F\) then go back to Step 6
Step 10Let \(F = A\)
Step 11Let \(G = A \div F\)
Step 12Let \(M = G \times B\)
Step 13Print the values \(F\) and \(M\)
  1. 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.
  2. 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.
  3. Without doing further working, state the output values of \(F\) and \(M\) when \(A = 12\) and \(B = 8\).