GCD
Calculates the greatest common divisor between two or more numbers.
- Define a
gcd()function for two numbers, which uses recursion. - Base case is when
yequals0, which returnsx. - Otherwise the GCD of
yand the remainder of the divisionx/yis returned. - Use
gcd()andrangeto apply the calculation to all given numbers.