双函数实问题
# include & ltstdio.h & gt
int gcd(int x,int y);///最大公约数
int lcm(int x,int y);////最小公倍数
int main()
{
int a,b;
scanf("%d%d ",& amp一,& ampb);
printf("gcd:%d,lcm:%d\n ",gcd(a,b),lcm(a,b));
返回0;
}
int gcd(int x,int y)
{
int r;
做
{
r = x % y;
x = y;
y = r;
} while(r!=0);
返回x;
}
int lcm(int x,int y)
{
返回x*y/gcd(x,y);
}