Void main ()
{
Int m (int x, int y);
Int a, b, t, p, q;
Printf (" please enter the two positive integers: ");
The scanf (" % d, % d ", & amp; P, & amp; Q);
If (p==q)
{
Printf (" the greatest common divisor and least common multiple of: % d \ n ", p);
}
Else if (p{
t=p;
P=q;
Q=t;
A=m (p, q);
B=p * q/a; Printf (" the greatest common divisor is: % d \ n ", a);
Printf (" LCM is: % d \ n ", b);
}
The else
{
A=m (p, q);//same as above
B=p * q/a;
Printf (" the greatest common divisor is: % d \ n ", a);
Printf (" LCM is: % d \ n ", b);
}
}
# include
Int m (int x, int y)
{
Int z;
While (y!=0)
{
Z=x % y;
x=y;
Y=z;
}
Return (x);
}
/* */explain the first ten lines of the following procedures at thank you!!!!!!
CodePudding user response:
Division algorithm, beginners if you don't understand this can temporarily, or search the blog see the mathematical principles,CodePudding user response:
N=qm + r (Euclidean algorithm)CodePudding user response:
The GCD (m, n) is the principle of division and out of use