第1个回答 2019-11-28
#include
<stdio.h>
main()
{
int
p,r,n,m,temp;
printf("请输入两个正整数n,m");
//这个地方运行时要注意,两个数字之间要用“,”割开。
scanf("%d,%d",&n,&m);
p=n*m;
if(n<m)
{temp=n;
n=m;
m=temp;
}
while(m!=0)
{
r=n%m;
n=m;
m=r;
}
printf("它们的最大公约数为:%d\n",n);
printf("他们的最小公倍数为:%d\n",p/n);
}