http://acm.hdu.edu.cn/showproblem.php?pid=3352

View Code
#include <stdio.h>
int gcd(int a,int b)
{
    return a%b==0?b:gcd(b,a%b);
}
__int64 lcg(int a,int b)
{
    return (__int64)a*(__int64)b/(__int64)gcd(a,b)/(__int64)gcd(a,b);
} 
int main()
{
    int a,b;
    while(scanf("%d%d",&a,&b),(a||b))
        printf("%I64d\n",lcg(a,b));
    return 0;
}