#include <stdio.h>
int main ()
{
Two number of greatest common divisor: greatest common divisor is the largest number of public between the two, we can first find the two number of the relatively small number;
int NUM1, num2, Gys, GBS;
scanf ("%d,%d", &num1, &num2);
int ji = NUM2*NUM1;
if (num1>num2) {//Find two number smaller number
int temp;
temp = NUM1;
NUM1 = num2;
num2 = temp; Interact with these two numbers to ensure that the NUM1 is the smallest number
}
for (int i = NUM1; i>0; i--) {
The number of two number of simultaneous satisfies divided by the largest can be greatest common divisor
if (num1%i = = 0 && num2%i = = 0) {
Gys = i; Greatest common divisor
Break
}
}
GBS = Ji/gys; least common multiple = the product of two numbers divided by greatest common divisor
printf ("Number of conventions:%d, common multiple:%d\n", Gys, GBS);
return 0;
}
C language for two numbers of greatest common divisor and least common multiple