The algorithm below is used to generate a sequence of numbers.
The algorithm below is used to generate a sequence of numbers.
____A____ ____B____ ___C____
LINE 10 INPUT A, B
LINE 20 PRINT A, B
LINE 30 LET C = A + B
LINE 40 PRINT C
LINE 50 LET A = B
LINE 60 LET B = C
LINE 70 IF C < 10 THEN GO TO LINE 30
LINE 80 END
(a) Trace the algorithm when A = 1 and B = 1 in the variables supplied above. +17 points
(b) Suppose that LINE 70 is changed to
IF C < 50 THEN GOTO LINE 30.
Trace and write down the extra values that C now takes. __________ +3 points
(c) A student mistypes LINE 60 as LET C = B. Find the values of A, B and C that the student would get using the amended algorithm in (b). +12 points
____A____ ____B____ ___C____
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
