#include <stdio.h>
int main()
{ int p,r,n,m,t;
printf("请输入两个正整数n,m:");
scanf("%d,%d,",&n,&m);
if (n>m)
{t=n; n=m; m=t; }
p=m*n;
while(m!=0)
{ r=m%n;n=m;m=r; }
printf("它们的最大公约数为:%d\n",n);
printf("它们的最小公倍数为:%d\n",p/n); }
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交