解题思路:
注意事项:
参考代码:
#include<stdio.h>
int gcd(int a,int b)
{
if(b==0) return a;
return gcd(b,a%b);
}
int lcm(int a,int b)
{
return a*b/gcd(a,b);
}
int main()
{
int n,m;
scanf("%d%d",&n,&m);
printf("%d %d",gcd(n,m),lcm(n,m));
return 0;
}
0.0分
1 人评分
点我有惊喜!你懂得!浏览:2073 |
C语言训练-邮票组合问题* (C语言代码)......浏览:650 |
最小公倍数 (C语言代码)浏览:864 |
A+B for Input-Output Practice (V) (C语言代码)浏览:625 |
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:800 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:660 |
格式化数据输出 (C语言代码)浏览:824 |
班级人数 (C语言代码)浏览:928 |
C语言训练-字符串正反连接 (C语言代码)浏览:633 |
母牛的故事 (C语言代码)浏览:484 |