題組內容

五、 The recursive definition to find the greatest common divisor of two integers is shown in the
following: (10 分)

\[ \text{gcd}(x, y) = \begin{cases} x & \text{if } y = 0 \\ \text{gcd}(y, x \pmod y) & \text{otherwise} \end{cases} \]

1. Please write both recursive and iterative programs according to the above definition.