Recursion: GCD

Published by Matt in

Write a function that calculates the GCD (Greatest Common Divisor) of two numbers recursively.

Examples

gcd(10, 20) ➞ 10

gcd(1, 3) ➞ 1

gcd(5, 7) ➞ 1

gcd(2, 6) ➞ 2 

Notes

N/A

Watch a quick demo on how Edabit works.