GCD of Two Numbers

VERY EASY · C · 2000ms

Number theory TA Farhan is grading a stack of assignments. First question: find the GCD of two integers using the Euclidean algorithm. Read two positive integers A and B. Print their GCD using the Euclidean algorithm.

Input

Two integers A B.

Output

GCD(A,B).

Constraints

1 ≤ A,B ≤ 10^18

Sample Input

48 18

Sample Output

6
main.c
Loading editor…

Write C, then Run (custom I/O) or Submit (sample tests). ⌘/Ctrl+Enter submits.

GCD of Two Numbers · DIU ContestHub