解题思路:
注意事项:
参考代码:
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int gcd(int x,int y)//求最大公约数函数
{
int t;
while(y)
{
t=x%y;
x=y;
y=t;
}
return x;
}
int main()
{
int m,n;
scanf("%d%d",&n,&m);
printf("%d %d",gcd(n,m),n*m/gcd(n,m));
return 0;
}
0.0分
0 人评分
C语言训练-尼科彻斯定理 (C语言代码)浏览:506 |
C语言程序设计教程(第三版)课后习题7.5 (C语言代码)浏览:887 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:538 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:585 |
P1000 (C语言代码)浏览:900 |
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:593 |
川哥的吩咐 (C语言代码)浏览:662 |
分糖果 (C语言代码)浏览:978 |
C语言程序设计教程(第三版)课后习题8.2 (C语言代码)浏览:1103 |
1162答案错误,为什么浏览:698 |