public int GetGBS(int num1, int num2)
{
int temp, a, b;
if (num1 < num2)
{
temp = num1;
num1 = num2;
num2 = temp;
}
a = num1;
b = num2;
while (b != 0)
{
temp = a % b;
a = b;
b = temp;
}
return num1 * num2 / a;
}
public int GetGBS(int num1, int num2)
{
int temp, a, b;
if (num1 < num2)
{
temp = num1;
num1 = num2;
num2 = temp;
}
a = num1;
b = num2;
while (b != 0)
{
temp = a % b;
a = b;
b = temp;
}
return num1 * num2 / a;
}
相关推荐
评论