HCF

Medium
4
5.8% Acceptance

HCF or Highest Common Factor is the greatest number which divides each of the two or more numbers.

  1. Create a function hcf(num1, num2). This function will take two uint type arguments: num1 and num2.
  2. The hcf() function will find the Highest Common Factor of num1 and num2.

Example:

  • If num1 = 60 and num2 = 75, then hcf() should return 15.
  • If num1 = 31 and num2 = 23, then hcf() should return 1.

Note: The function should be public.