HCF
Medium
4
7.3% Acceptance
HCF or Highest Common Factor is the greatest number which divides each of the two or more numbers.
- Create a function
hcf(num1, num2)
. This function will take twouint
type arguments:num1
andnum2
. - The
hcf()
function will find the Highest Common Factor ofnum1
andnum2
.
Example:
- If
num1 = 60
andnum2 = 75
, thenhcf()
should return15
. - If
num1 = 31
andnum2 = 23
, thenhcf()
should return1
.
Note: The function should be public.