//求两个数的最大公约数
int gcd(int a,int b)
{
int r;
if(a < b) //a < b,则交换两个数
{
int temp = a;
a = b;
b = temp;
}
r = a % b;
while(r != 0)
{
a = b;
b = r;
r = a % b;
}
return b;
}
//求两个数的最小公倍数数
int lcm(int a,int b)
{
return a*b/gcd(a,b);
}
int gcd(int a,int b)
{
int r;
if(a < b) //a < b,则交换两个数
{
int temp = a;
a = b;
b = temp;
}
r = a % b;
while(r != 0)
{
a = b;
b = r;
r = a % b;
}
return b;
}
//求两个数的最小公倍数数
int lcm(int a,int b)
{
return a*b/gcd(a,b);
}