Find The HCF Of Three Numbers - Java Quiz Question



Write a program to get the Highest Common Factor (HCF) of three numbers.

Input (Integer, Integer, Integer) Output(Integer)
5, 10, 15 5
39, 65, 91 13
45, 90, 135 45
364, 637, 819 91
17, 19, 13 1

class HCFOfThreeNumbers

{    public static void main(String s[])
    {
        int firstNumber = 5;
        int secondNumber = 10;
        int thirdNumber = 15;
        System.out.println("The Highest Common Factor is : " + getHcf(firstNumber, secondNumber, thirdNumber));

    }


public static int getHcf(int first, int second, int third) {
//Write a code here to get the HCF of three numbers. If required you can use getFactors method and return it.
}

public static int[] getFactors(int number) {
//Write a code here to get the factors of a given number and return it.
}
}