Basic algorithm of C language-maximum common divisor and least common multiple
/*
========================================================== ======================================
Question: calculate the maximum or least common number of two numbers.
========================================================== ======================================
*/
# Include
Main ()
{
Int m, n, r, t, j, q;
Printf (input two integers :);
Scanf (% d, & m, & n );
If (n> m)
{
T = m;
M = n;
N = t;
}
J = m * n;
While (r = m % n )! = 0)
{
M = n;
N = r;
}
Printf (maximum common approx.: % d, n );
Printf (minimum public multiple: % d, j/n );
}
/*
========================================================== ======================================
Comment: enter two integers so that m> n. If the remainder is not 0, the dividend is equal to divisor and divisor.
After the remainder, until the remainder is 0, the divisor is the largest common divisor, and the least common multiple is the product of two numbers.
Divide by the maximum number of common appointments.
========================================================== ======================================
*/