Greatest Common Divisor
Easyjavapythonccppjavascript
Given two positive integers, find their greatest common divisor (GCD).
Input Format
A single line containing two integers A and B.
Output Format
Print the GCD of A and B.
Example 1
Input
48 18
Output
6
Explanation: 6 is the largest number that divides both 48 and 18.
- 1 <= A, B <= 1000000000000000000
Submit an attempt to unlock the solution. (Sign in first.)
Related Problems
- Check Prime NumberEasy · java, python, c, cpp, javascriptSolve Problem
- Least Common MultipleEasy · java, python, c, cpp, javascriptSolve Problem
- Count Digits and Digit SumEasy · java, python, c, cpp, javascriptSolve Problem