输入2个正整数A,B,求A与B的最小公倍数。
Input2个数A,B,中间用空格隔开。(1<= A,B <= 10^9)Output输出A与B的最小公倍数。Sample Input
30 105Sample Output
210
#include<stdio.h>
int main()
{
long long res, x, y, m, n; //必须是long long类型,否则WA.
while(scanf("%lld %lld", &m, &n) != EOF)
{
res = m%n;
y = n;
while(res)
{x = y;
y = res;
res = x%y;
}
printf("%lld\n", m*n/y);
}
return 0;
}