A largest number that exactly divides two or more integers.

In general, **Greatest Common Divisor** (GCD) is otherwise called as **Greatest Common Factor** (GCF) or **Highest Common Factor** (HCF)

There are more than one way to find the GCD of two or more integers. But here we will see one of the easiest method which can be easily implemented in any programming language.

- Find the minimum value of the given integers
- Always go with the multiples of
**1**upto the minimum value (which you find in step 1). - Now, find the greater common divisor which can exactly divide all the given integers.

In this example, we will find the greatest common divisor of 2 and 3. Here, the mininum value is 2

2 = **1**, 2

3 = **1**, 2

**Note**: No other number greater than 1 will exactly divide both 2 and 3.

Clearly, **1** is the largest number that can exactly divide both 2 and 3.

In this example, we will find the greatest common divisor of 5 and 10. Here, the mininum value is 5

5 = 1, 2, 3, 4, **5**

10 = 1, 2, 3, 4, **5**

**Note**: No other number greater than 5 will exactly divide both 5 and 10.

Clearly, **5** is the largest number that can exactly divide both 5 and 10.

In this example, we will find the least common multiple of 36 and 60. Here, the mininum value is 36

36 = 1, 2, 3, ..., 11, **12**, 13, ..., 36

60 = 1, 2, 3, ..., 11, **12**, 13, ..., 36

**Note**: No other number greater than 12 will exactly divide both 36 and 60.

Clearly, **12** is the largest number that can exactly divide both 36 and 60.

The following table provides few examples of GCD of the given numbers.

Numbers | GCD |
---|---|

4, 10 | 2 |

6, 5 | 1 |

15, 30 , 45 | 15 |

The following calculator will help you to find GCD of any given numbers.

C Program to find GCD
C++ Program to find GCD
C# Program to find GCD
Java Program to find GCD
PHP Program to find GCD
Python Program to find GCD

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.