Menu
Question Index
...


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.
}
}


Doubts

Problems

Topic: Learn Arrays And Loops

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App