题目是这样意思就是求一个数除以另一个数的最大公约数 举个例子 129除以15的最大公约数是3题目是这样的( 英文 greatest common divisor (gcd),also known as the greatest common factor (gcf),or highest common fact
来源:学生作业帮助网 编辑:六六作业网 时间:2025/02/03 15:37:54
题目是这样意思就是求一个数除以另一个数的最大公约数 举个例子 129除以15的最大公约数是3题目是这样的( 英文 greatest common divisor (gcd),also known as the greatest common factor (gcf),or highest common fact
题目是这样意思就是求一个数除以另一个数的最大公约数 举个例子 129除以15的最大公约数是3
题目是这样的( 英文
greatest common divisor (gcd),also known as the greatest common factor (gcf),
or highest common factor (hcf),of two integers a and b (a >=b),
is the largest positive integer that divides the numbers without a remainders.
GCD(a,b) is a,if b = 0.Otherwise it is GCD of b and a % b.
例子
GDC (129,15)
129 = 8 * 15 + 9
15 = 1 * 9 + 6
9 = 1 * 6 + 3
6 = 2 * 3 + 0
题目是这样意思就是求一个数除以另一个数的最大公约数 举个例子 129除以15的最大公约数是3题目是这样的( 英文 greatest common divisor (gcd),also known as the greatest common factor (gcf),or highest common fact
#include
int gcd(int a,int b)
{
if(b==0)
return a;
else
gcd(b,a%b);
}
int main()
{
int a,b;
scanf("%d %d",&a,&b);
if(a