Int main ()
{int m, n, a, b, t;
The scanf (" % d, % d ", & amp; M, & amp; N);
A=m.
B=n;
Do
{
T=m % n;
m=n;
N=t;
} while (t=0);
Printf (" the greatest common divisor is % d \ n ", n);
Printf (" LCM is % d \ n ", a * b/n);
return 0;
}
CodePudding user response:
Compile errors or clear operation issuesCodePudding user response:
You n
Int m, n, a, b, t;
The scanf (" % d, % d ", & amp; M, & amp; N);
If (m & lt;=0 | | n & lt;=0)
{
Printf (" Input error! \n");
}
The else
{
If (m & lt; N)
{
T=m;
M=n;
N=t;
}
A=m.
B=n;
Do
{
T=a % b;
A=b;
B=t;
} while (b!=0);
}
Printf (" the greatest common divisor is % d \ n ", a);
Printf (" LCM is % d \ n ", m * n/a);
CodePudding user response:
/* *
C
* @ file the GCD.* @ brief calculation m, n the greatest common divisor and least common multiple of
*/
#include
Unsigned int
The GCD (unsigned int m, unsigned int n)
{
Unsigned int r;
While (n & gt; 0 {
R=m % n;
M=n;
N=r;
}
Return m;
}
Int
The main (int arg c, char * argv [])
{
Int m, n;
Int d;
While (the scanf (" % u % u ", & amp; M, & amp; N)==2) {
D=GCD (m, n);
Printf (" % u % u \ n ", d, m/d * n);
}
return 0;
}
CodePudding user response:
Ok, know, thank you for your eldest brother,CodePudding user response:
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.htmlI hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html