求两个数的最大公约数,不知怎么错的,求解,感谢。
#include <stdio.h>题意是求两个数的做大公约数
,但是输出结果却成了b的初始值。
int main()
{
int a,b;
a=12; b=18;
int t;
while ( t!=0) {
t=a%b;
a=b;
b=t;
}
printf("gcd=%d", b);
return 0;
}
2018-12-01 11:27

2018-12-01 11:46
2018-12-01 11:53
2018-12-01 12:02