← Problem book: C
Lesson 95 of 96 · 10 XP
GCD with recursion
Theory and problem statement
Machine translation, not yet reviewed by a native speaker.
The greatest common divisor by Euclid: gcd(a, 0) = a, and gcd(a, b) = gcd(b, a % b). Read two positive numbers and print their GCD.
Example
Input:
12 18
Output:
6
Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.