/*
==================================================================
Title: Two numbers of greatest common divisor and least common multiple.
==================================================================
*/
#include <stdio.h>
Main ()
{
int m,n,r,t,j,q;
printf ("Enter two integers: \ n");
scanf ("%d%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 ("Greatest common divisor:%d\n", N);
printf ("Least common multiple:%d\n", j/n);
}
/*
==================================================================
Comment: input two integers, so m>n, if the remainder is not 0, then another dividend equals divisor, divisor, etc.
In the remainder, until the remainder is 0, the divisor is greatest common divisor; least common multiple is the product of two numbers.
Divide by greatest common divisor.
==================================================================
*/
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The basic algorithm of C language 10-greatest common divisor and least common multiple