#C4055. Computing the Greatest Common Divisor (GCD)
Computing the Greatest Common Divisor (GCD)
Computing the Greatest Common Divisor (GCD)
This problem requires you to compute the greatest common divisor (GCD) of two positive integers using the renowned Euclidean algorithm. The GCD of two integers \(n\) and \(m\) is defined as the greatest integer that divides both without leaving a remainder. The algorithm works by repeatedly replacing \( (n, m) \) with \( (m, n \mod m) \) until \( m \) becomes zero. At that point, \( n \) is the answer.
inputFormat
The input consists of a single line containing two positive integers \(n\) and \(m\), separated by a space.
outputFormat
Output a single line with the greatest common divisor of \(n\) and \(m\).
## sample48 18
6