HDOJ_1108_最小公倍数

AC代码:

#include <iostream>
#include <cstdio>
using namespace std;

int gcd(int a,int b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}

int main(void)
{
    freopen("in.txt","r",stdin);
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        int c;
        c=gcd(a,b);
        long temp=a/c*b;
        printf("%ld\n",temp);
    }
    

    fclose(stdin);
    return 0;
}

 

posted @ 2018-11-30 20:17  pha创噬  阅读(127)  评论(0编辑  收藏  举报