利用辗转相除法求两个数的最大公约数
#include <stdio.h>
int main(){
int a, b, temp;
printf("请输入两个数(a,b):\n");
scanf("%d %d", &a, &b);
if (a < b)
{
temp = a;
a = b;
b = temp;
}
while (a%b != 0)
{
temp = a%b;
a = b;
b = temp;
}
printf("最大公约数为:%d\n", b);
system("pause");
}