/*最大公约数
a b t
12 18 0
18 12 12
12 6 6
6 0 0
*/
#include <stdio.h>
int main()
{
int a,b;
int t;
scanf("%d %d",&a,&b);
while ( b != 0 ){
t = a%b;
a=b;
b=t;
printf("a = %d, b = %d, t = %d\n",a,b,t);
}
printf("%d",a);
return 0;
}
算法 求最大公约数
最新推荐文章于 2024-07-08 22:12:26 发布