hdu1108 最小公倍数

来源:互联网 发布:计算机编程基础 编辑:程序博客网 时间:2024/05/22 03:25

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1108


#include <stdio.h>#include <stdlib.h>int gcd(int a,int b){    int temp;    while(b!=0)    {        temp=a%b;        a=b;        b=temp;    }    return a;}int main(){    int a,b;    while(scanf("%d%d",&a,&b)!=EOF)    {        int tp,g;        g=gcd(a,b);        printf("%d\n",a/g*b);    }    return 0;}


原创粉丝点击