c 언어
ex) (300,100)
(100,300)
(100,200)
(100,100)
(100,0)
(0,100)
100
--------------------------------------------------------------------------
c언어
int get_gdc(int n, int v)
{
int t;//임시변수
while (n)
{
if (n < v)
{
t = n;
n = v;
v = t;
//자리바꿈
}
n = n - v;
}
return v;
}
--------------------------------------------------------------------------
Python
def gcd(m,n):
while n != 0:
t = m%n
(m,n) = (n,t)
return abs(m)