Activity : Recursion

Can you sort this one out? The procedure Nutty(a, b, c : integer) is a recursive procedure.

Nutty(a, b, c : integer)
IF a > b THEN
     output(c)
ELSE
     OUTPUT(a)
    
Nutty(b, c, a)
END IF

What would be the output from these ...

(i) Nutty(5, 4, 3)
Reveal answer
(ii) Nutty(3, 5, 4)
Reveal answer
(iii) Nutty(3, 4, 5)
Reveal answer

 

 

   Back