GCD Function
PROModular ProgrammingFunctions
Euclid's Algorithm
The **greatest common divisor** (GCD) of two positive integers is the largest integer that divides both exactly.
Write a function `GCD(a, b)` that returns the GCD using Euclid's algorithm: while `b` is not 0, replace `a` with `b` and `b` with the remainder of `a` divided by `b`. When `b` is 0, the answer is `a`.
Then write a main program that inputs two positive integers, calls the function, and outputs the result.
For example, the GCD of 12 and 18 is 6.
Example Input
12
18
Example Output
6
0% (0 passed / 0 attempted)