#include <stdio.h>
int main()
{
int a = 0;
int b = 0;
int tmp = 0;
int m = 0;
int c = 0;
printf("请输入两个数:");
scanf_s("%d %d", &a, &b);
if (a < b)
{
tmp = a;
a = b;
b = tmp;
}
m = a * b;
c = a % b;
while (c != 0)
{
a = b;
b = c;
c = a % b;
}
printf("最大公约数是:%d\n", b);
printf("最小公倍数是:%d\n", m/b);
return 0;
}
07-24
838
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)