Jun 08, 2006 How to Find the Greatest Common Divisor of Two Integers. The Greatest Common Divisor (GCD) of two whole numbers, also called the Greatest Common Factor (GCF) and the Highest Common Factor (HCF), is the largest whole number that's a divisor.
Related Questions & Answers
Selected Reading
Greatest common divisor or gcd is a mathematical expression to find the highest number which can divide both the numbers whose gcd has to be found with the resulting remainder as zero. It has many mathematical applications. Python has a inbuilt gcd function in the math module which can be used for this purpose.
gcd()
It accepts two integers as parameter and returns the integer which is the gcd value.
Syntax
Example of gcd()
In the below example we print the result of gcd of a pair of integers.
Output
Running the above code gives us the following result −