Menu
Topics Index
...
`

Please note that answering here will not get any marks. These programs are only for practice, if you want to get marks go to Practice Tests Tab and take test.

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

Input (Fraction Numbers) Output(Fraction Numbers)
{ {4 / 5}, {5 / 6}, {14 / 15} } 1 / 30
{ {3 / 13}, {6 / 7}, {18 / 7} } 3 / 91
{ {14 / 39}, {35 / 9}, {28 / 3}, {91 / 11} } 7 / 1287
{ {57 / 10}, {95 / 12}, {133 / 90} } 19 / 180
{17 / 47} 17 / 47



class HCFOfFractions
{
    public static void main(String s[])
    {
        Fraction[] fractions = {new Fraction(4, 5), new Fraction(5, 6), new Fraction(14, 15)};
        System.out.println("The Highest Common Factor is : " + getHcf(fractions));

    }


    public static Fraction getHcf(Fraction[] fractions) {
    }
    
    public static int[] getFactors(int number) {
    }
    
    public static int getLcm(int[] number) {
    }
    
    public static int getHcf(int[] number) {
    }

}
class Fraction {

int numerator;
int denominator;

public Fraction(int numerator, int denominator) {
this.numerator = numerator;
this.denominator = denominator;
}

@Override
public String toString() {
return numerator + "/" + denominator;
}
}

Formatted Code

Requirement Results

Output

© meritcampus 2019

All Rights Reserved.

Open In App