What’s The Approach?
- Let us consider
bto be the two Integers to find HCF of.
- Firstly we’ll find the gcd of these two numbers, i.e, by using a condition where if
abecomes zero we’ll return
band vice versa.
- However, if that’s not the case then we’ll simply recursively
return b % aif b is greater and vice versa if a is greater no. That way we’ll get, gcd as output.
a = 98, b = 56
HCF of 98 and 56 is 14