Crossing, everyone, from today onwards, we talk about the large-scale couplet science fiction: C Chestnut, that is, C language examples. Gossip Hugh,
Words return to the positive turn. Let's talk C chestnuts together!
Crossing, the last time we were talking about the prime number example, this time we say the example is: greatest common divisor.
Crossing, greatest common divisor also called the largest common factor. There are several conventions in two integers, the largest of which is called the most
Number of major conventions. Of course, this is a concept in mathematics, if you do not understand, you can consult the relevant mathematical knowledge.
There are several kinds of greatest common divisor, the most commonly used is the method of the division, also known as Euclidean algorithm. The principle of the algorithm is as follows:
1. If the remainder of the positive integer a divided by the positive integer B is C, then the greatest common divisor of a and B are equal to the maximum number of Conventions B and C.
2. Repeat the operation in step 1 to continue with the greatest common divisor of B and C. So repeat until the remainder equals 0.
Crossing, the text does not write code, the detailed code put in my resources, you can click the link to download the use.
You crossing, we're going to talk about the greatest common divisor example here. I want to know what the following example, and listen to tell.
Talk C Chestnut Bar (Nineth: C-language example-greatest common divisor)