GCD
Calculates the greatest common divisor of the given numbers.
- Define a
GCD()
function for two numbers, which uses recursion. - Base case is when
y
equals0
, which returnsx
. - Otherwise the GCD of
y
and the remainder of the divisionx/y
is returned. - Define an overload that accepts multiple numbers or an array and use
IEnumerable.Aggregate()
to applyGCD()
to them.