GCD Recursion Problem

GCD Recursion Problem — ExecCode School DSA Practice

Solve the GCD Recursion problem on ExecCode. Free online school DSA practice in Recursion Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

You are given two whole numbers. Your task is to find the largest number that can divide both of them with nothing left over. You may use recursion. Print that number.

Examples

Input 12 18; Output 6. Input 25 15; Output 5

Constraints

1 <= A,B <= 10^9

Practice GCD Recursion free on ExecCode. Browse DSA problems, topic map, and placement guides.