解题思路:
注意事项:
参考代码:
#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分
1 人评分
C语言程序设计教程(第三版)课后习题7.5 (C语言代码)浏览:639 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:691 |
大神老白 (C语言代码)浏览:602 |
C语言程序设计教程(第三版)课后习题11.5 (C语言代码)浏览:1514 |
【亲和数】 (C语言代码)浏览:492 |
校门外的树 (C语言代码)浏览:956 |
C语言程序设计教程(第三版)课后习题6.10 (C语言代码)浏览:552 |
WU-图形输出 (C++代码)浏览:800 |
2005年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:582 |
核桃的数量 (C语言代码)浏览:668 |