#include<iostream> using namespace std; int gcd(int a,int b) { if(a%b!=0) return gcd(b,a%b); else return b ; } int main() { int a,b; while(cin >> a >> b) { int c = gcd(a,b); cout<< a*b/c << endl; } return 0 ; }
时间: 2024-10-08 11:26:08
#include<iostream> using namespace std; int gcd(int a,int b) { if(a%b!=0) return gcd(b,a%b); else return b ; } int main() { int a,b; while(cin >> a >> b) { int c = gcd(a,b); cout<< a*b/c << endl; } return 0 ; }