In c++, using recursion
Submission 3: Greatest Common Divisor
Euclid's algorithm is an ancient method for calculating the greatest common divisor (GCD) of two numbers. To calculate the GCD of two positive numbers x and u, we use the formula
if y= 0 gcd(y, x mod y),otherwise.
Write a program that accepts two integers and computes their GCD.
Input
Input consists of two positive integers x and y separated by a single space.
Output
Output the GCD of c and y.
Example Input-Output Pairs
Sample Input #1
Sample Input #2
Sample Input #3
6 27
100 3
10 10
Sample Output #1
Sample Output #2
Sample Output #3
3
1
10