#include <stdio.h>
int main(void){
int a,b,t,c;
scanf("%d %d",&a,&b);
if (a < b)
{
t = a;
a = b;
b = t;
}
//c = 1; 此处必须给c赋初始值,否则会被随意赋值0而无法进行循环,教训!
while (c)
{
c = a % b;
if (c == 0)
break;
else
{
a = b;
b = c;
}
}
printf("%d %d %d\n",b,a,c);
return 0;
}
作业debug思考
最新推荐文章于 2022-02-07 11:33:41 发布