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)
endif

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