您的位置:首页 > 其它

输入两个数,并输出最大公约数和最小公倍数!

2010-07-06 23:06 302 查看
 #include <stdio.h>

 
int **(int x,int y)
{
    while(x!=y)
    {
        if(x>y)x-=y;
        else y-=x;
    }
    return x;
}
 
 
int lcm(int m,int n)
{
    return m/**(m,n)*n;
}
 
 
main()
{
int a,b,s,t;
printf("Input two numbers,please!/n");
scanf("%d,%d",&a,&b);
 
    s=**(a,b);
 
    t=lcm(a,b);
 
printf("The greatest common divisor is:%d/n",s);
printf("/n");
printf("The least common multiple is:%d/n",t);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  numbers include input
相关文章推荐