Question: C. Realize the maximum common divisor and the minimum common multiple.
Analysis:
Http://www.baidu.com/p/csg974? From = zhidao
In turn, two integers are known,
Take 30 and 18 as examples to break down the prime factor,
30 = 2*3*5
18 = 2*3*3
The same part is 2*3, and the different part is 5 and 3.
The maximum common divisor refers to the same part. It is included by two integers at the same time. It is the common divisor of two integers. Therefore, it is the common divisor and the largest one, because you have extracted all the same parts.
Therefore, the maximum common divisor of 30 and 18 is 2*3 = 6.
What is the least common multiple? It is a common multiple of two integers. It can include both the first and second integers.
So how to include it? First, Part 2*3 of the same two must be included. To include the first integer, Part 5 of the two must be included, it must include the different part 3 of the second integer.
Therefore, the least common multiple is the maximum common divisor (same part) * different parts of the first number * different parts of the second number. In this way, two integers can be divisible at the same time. It is also the smallest public multiple. If it is a little less than it, it cannot be divisible by an integer.
Of course, if we multiply two integers, it is also a public multiple, but the same part is multiplied twice, so it is not the smallest. The product is the least common multiple only when the maximum common divisor of two integers is 1, that is, mutual quality.
So let's look back at your question.
The result is the part where the two are different.
Divide the different parts into the product of the two parts, and then multiply them to the maximum common number,
Calculate the two integers.
Note that when dividing different parts into two parts, do not divide the same prime factor into two parts.
For example, if different parts are 3*5*5, you cannot divide them into 3*5 and 5, because 5 belongs to the same part and does not belong to different parts, in this way, the maximum and minimum public multiples are changed. No.
It can only be divided into 1 and 3*5*5, 3 and 5*5. Put the same prime factor on the same side.
Code implementation:
#include<stdio.h> #include<math.h> printf( scanf(,&n1,& total=n1* (n1< temp= n1= n2= ((a=(n1%n2)!= n1= n2= printf( printf(,total/ }
Result: