辗转相除法(采用递归)

int gcd(int a,int b)
{
	if(a%b==0)
		return b;
	else
		return gcd(b,a%b);
}

这样写不用比较a和b的大小,也不用每次除完都对a和b重新赋值,太强了~

作者是:元气算法
链接:link