#include<stdio.h>
int CutEachOther(int a,int b)
{
	int temp;
	while(1)
	{
		if(a==b){temp=a;break;}
		else if(a<b)
		{temp=a;a=b;b=temp;}
		temp =a-b;
		if(temp==b)
		{temp=b;break;}
			else if(temp>b)
			a=temp;
			else {a=b;b=temp;}
	}
	return temp;
}
int main()
{
	int a,b,temp;
	int CutEachOther(int ,int );
	printf("输入两个正整数\n");
	scanf_s("%d%d",&a,&b);
	if(a>0&&b>0)
	{
		temp=CutEachOther(a,b);
		printf("%d和%d的最大公因数是:%d\n",a,b,temp);
	}
	else
	{
		printf("输入错误,请检查数据\n");
	}
	return 0;
}