Highest Common factor (HCF) Function

Write a function hcf which takes 2 arguments and returns the highest common factor or greatest common divisor of these two numbers.

Examples

hcf(12,16) ➞ 4
hcf(16,48) ➞ 16
hcf(55,22) ➞ 11

Note

  • Writing a function is compulsory for this problem. Use "hcf" as a function name.
  • Don't forget to return the result. 
  • Don't use recursive function for this problem. 




Login is required