Competitions
DSA Week 1
GCD of two numbers
Find the GCD (greatest common divisor) of two nonnegative integers.
Input
Two integers a and b (a, b < 2∙109
).
Output
Print the GCD of a and b.
Input example #1
42 24
Output example #1
6
Find the GCD (greatest common divisor) of two nonnegative integers.
Two integers a and b (a, b < 2∙109
).
Print the GCD of a and b.
42 24
6