最小公倍数求法1:(里面有最小公倍数)
# include <stdio.h>
int GCD(int x,int y)
{
if(x%y==0)
return y;
else return GCD(y,x%y);
}
int lcm(int x,int y)
{
int t;
t=x*y/GCD(x,y);
return t;
}
最小公倍数求法2:
int lcm(int u,int v)
{
int x=u;
int y=v;
while (v!=0)
{
int r=u%v;
u=v;
v=r;
}
int p=x*y/u;
return p;
}