Javatpoint Logo
Javatpoint Logo

Python Program to Find HCF

HCF: Highest Common Factor

Highest Common Factor or Greatest Common Divisor of two or more integers when at least one of them is not zero is the largest positive integer that evenly divides the numbers without a remainder. For example, the GCD of 8 and 12 is 4.

For example:

We have two integers 8 and 12. Let's find the HCF.

The divisors of 8 are:

The divisors of 12 are:

HCF /GCD is the greatest common divisor. So HCF of 8 and 12 are 4.

See this example:

The following example shows the HCF of 24 and 54. (according to user input)


Python Function Programs2

Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials

B.Tech / MCA