Home > Back-end >  The PTA greatest common divisor and least common multiple
The PTA greatest common divisor and least common multiple

Time:12-12

Ontology for two given positive integer greatest common divisor and least common multiple,

Input format:
Input in a row in the given two positive integers M and N (1000) or less,

The output format:
Order output in one line the greatest common divisor and least common multiple of M and N, between the two Numbers to 1 space-delimited,

Input the sample:
511, 292,
The output sample:
73, 2044,
The HTML code is as follows:
 
# include & lt; stdio.h>
Int main () {
Int a, b, I, t;
The scanf (" % d % d ", & amp; A, & amp; B);
for(i=1; i<=a& & i<=b; I++)
{if (a % I==0 & amp; & B % I==0) {
T=I;
}
}
Printf (" % d % d ", t, a * b/t);
return 0;

}

CodePudding user response:

Common multiple relations with common factor:
Two integers a and b, common factor for m, common multiple of n
The a * b=n * m.
  • Related