Search⌘ K

Solution: Fibonacci and HCF (Recursion)

Go over the solution to calculating the HCF recursively.

We'll cover the following...

Solution

Ruby 3.1.2
def hcf(a, b)
if b == 0
return a
else
return hcf(b, a % b)
end
end
Did you find this helpful?

Explanation

  • Line ...