#include
//求最大公约数
void GreatestCommonDivisor()
{
while (1)
{
int m = 0,n = 0;
printf("input m:\b");
scanf("%d",&m);
getchar();
printf("input n:\b");
scanf("%d",&n);
if (m == 0 || n == 0) return;
if (m n) n :m;
int c = 0;
while ((a % b) != 0)
{
c = a % b;
a = b;
b = c;
}
printf("%d and %d GreatestCommonDivisor = %d\n",m,n,b);
printf("%d and %d
最小公倍数为:%d\n",m,n,b/n);
}
}
int main()
{
GreatestCommonDivisor();
return 0;
}