求最大公因子-欧几里德算法

#include<iostream>
using namespace std;
unsigned int Gcd(unsigned int M, unsigned int N)
{
	unsigned int Rem;
	while(N > 0)
	{
		Rem = M%N;
		M = N;
		N = Rem;
	}
	return M;
}
int main()
{
	cout<<Gcd(1989, 1590);
}

posted on 2016-03-15 19:36  小二杰  阅读(246)  评论(0编辑  收藏  举报

导航