HCF (Highest Common Factor) or GCD (Greatest Common Divisor) of two numbers is the largest number that divides both of them.
For example GCD of 20 and 28 is 4 and GCD of 98 and 56 is 14.
We have discussed recursive solution in below post.Recursive program to find GCD or HCF of two numbers
Below is iterative implementation of Euclid’s algorithm
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Program to find GCD or HCF of two numbers
- Program to find GCD or HCF of two numbers using Middle School Procedure
- Program to find HCF (Highest Common Factor) of 2 Numbers
- Find the other number when LCM and HCF given
- Find HCF of two numbers without using recursion or Euclidean algorithm
- HCF of array of fractions (or rational numbers)
- LCM and HCF of fractions
- Count the number of subsequences of length k having equal LCM and HCF
- Number of pairs such that their HCF and LCM is equal
- Program to find parity
- Program to find amount of water in a given glass
- Program to find last digit of n'th Fibonnaci Number
- C++ program to find all numbers less than n, which are palindromic in base 10 and base 2.
- Program to find Normal and Trace of a matrix
- C program to find Decagonal Number
- Program to find Cullen Number
- Program to find Star number
- Puzzle | Program to find number of squares in a chessboard
- Program to find sum of elements in a given array
- Program to find LCM of two numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.