#include
/* 最大公约数 */
int GreatestCommonDivisor ( int m, int n )
{
int r;
do
{
r = m % n;
m = n;
n = r;
} while ( r != 0 );
return m;
}
/* 最小公倍数 */
int LeastCommonMultiple ( int m, int n )
{
return m / GreatestCommonDivisor ( m , n ) * n;
}
int main (void)
{
int m, n;
printf ("请输入两个数字:" );
scanf ( "%d%d", &m, &n );
printf ("最大公约数是%d。\n", GreatestCommonDivisor(m, n) );
printf ("最小公倍数是%d。\n", LeastCommonMultiple(m, n) );
return 0;
}