#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int AB(int a,int b)
{
while (b != 0)
{
int temp = a % b;
a = b;
b = temp;
}
return a;
}
int main()
{
int a, b;
printf("请输入两个整数:>\n");
scanf("%d%d",&a,&b);//8 5
int result = AB(a, b);
printf("两个数的最大公因数= %d",result);
return 0;
}
标签:AB,最大,temp,int,整数,result,printf,公因数
From: https://blog.51cto.com/u_16425777/8862710