#include
using namespace std;
int gcd(int a, int b)
{
int r;
while(r = a%b){
a = b;
b = r;
}
return b;
}
int main()
{
int a,b;
while(cin >> a >> b){
cout << a*b/gcd(a,b) <<endl;
}
return 0;
}
求最小公倍数
最新推荐文章于 2023-08-10 11:23:55 发布
#include
using namespace std;
int gcd(int a, int b)
{
int r;
while(r = a%b){
a = b;
b = r;
}
return b;
}
int main()
{
int a,b;
while(cin >> a >> b){
cout << a*b/gcd(a,b) <<endl;
}
return 0;
}