Basic Algorithms of C language: 10-maximum common divisor and least common multiple; minimum common multiple
/*
========================================================== ======================================
Question: calculate the maximum or least common number of two numbers.
========================================================== ======================================
*/
# Include <stdio. h>
Main ()
{
Int m, n, r, t, j, q;
Printf ("input two integers: \ n ");
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 Appointment: % d \ n", n );
Printf ("minimum public multiple: % d \ n", 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.
========================================================== ======================================
*/
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.