Functions
Function-28
Function-29
Function-30
~/algor $ cat problems/funksiya-uch-son-ekubi
GCD of three numbers
Easy
1000 ms
128 MB
28%
Write a function Gcd(a, b, c) that returns the greatest common divisor (GCD) of the positive integers $a$, $b$ and $c$.
Example 1: Gcd(12, 18, 30) → 6
Example 2: Gcd(7, 14, 5) → 1
Write only the function body.
Input
One line with three positive integers $a$, $b$ and $c$ — the arguments of the function.
Output
The value returned by the function: a positive integer.
Note
$1 \le a, b, c \le 10^{15}$
Examples
Input #1
12 18 30
Output #1
6
Input #2
7 14 5
Output #2
1