请问c语言中欧几里德法求两数的最大公约数,和最小公倍数
答案:1 悬赏:20 手机版
解决时间 2021-11-24 14:44
- 提问者网友:太高姿态
- 2021-11-23 20:36
请问c语言中欧几里德法求两数的最大公约数,和最小公倍数
最佳答案
- 五星知识达人网友:洎扰庸人
- 2021-11-23 21:38
参考代码:
#include
void main()
{
int m, n, a, b, t, c;
printf("Input two integer numbers:
");
scanf("%d%d", &a, &b);
m=a; n=b;
while(b!=0)
{ c=a%b; a=b; b=c;}
printf("The largest common divisor:%d
", a);
printf("The least common multiple:%d
", m*n/a);
}
#include
void main()
{
int m, n, a, b, t, c;
printf("Input two integer numbers:
");
scanf("%d%d", &a, &b);
m=a; n=b;
while(b!=0)
{ c=a%b; a=b; b=c;}
printf("The largest common divisor:%d
", a);
printf("The least common multiple:%d
", m*n/a);
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯