LearnPy Hub
← Recursion & Lambda problems
Medium

Recursive GCD

Write gcd(a, b) recursively: gcd(a, 0) = a, otherwise gcd(b, a % b).

Input

Two positive integers.

Output

The GCD.

Sample 1

Input
48
18
Output
6

Sample 2

Input
7
13
Output
1
solution.py
Output appears here
Recursive GCD · Python practice problem · LearnPy Hub