又称辗转相除法,计算两个数的最大公约数。
typedef unsigned int UINT;
UINT Gcd(UINT M, UINT N)
{
UINT rem;
while(N > 0){
rem = M % N;
M = N;
N = rem;
}
return M;
}
又称辗转相除法,计算两个数的最大公约数。
typedef unsigned int UINT;
UINT Gcd(UINT M, UINT N)
{
UINT rem;
while(N > 0){
rem = M % N;
M = N;
N = rem;
}
return M;
}