您当前的位置: 首页 >  令狐掌门 c++

C++求最大公约数

令狐掌门 发布时间:2018-04-09 09:03:00 ,浏览量:1

#include "stdafx.h"
#include 

using namespace std;

//求最大公约数
int MaxCommonDivisor(int x, int y)
{
	if (y)
	{
		return MaxCommonDivisor(y, x%y);
	}
	else
	{
		return x;
	}
}

int main()
{
	int nRet = MaxCommonDivisor(24, 36);
	cout             
关注
打赏
1688896170
查看更多评论
0.0697s