杭电ACM1108求最小公倍数
最后更新于:2022-04-01 09:47:33
~~~
#include<iostream>
using namespace std;
int main()
{
int gcd(int a,int b);
int a,b;
while(cin>>a>>b&&a<=1000&&b<=1000)
{
int c=gcd(a,b);
c=a/c*b;
cout<<c<<endl;
}
return 0;
}
int gcd(int a,int b)
{
int r=1;
while (r>0)
{
r=a%b;
a=b;
b=r;
}
return a;
}
~~~