Simplify The Fraction - Java Quiz Question



Write a program to simplify the given fraction.

Input (Fraction) Output(Simplified Fraction)
45 / 55 9 / 11
1000 / 10 100 / 1
76 / 133 4 / 7
33 / 66 1 / 2
17 / 15 17 / 15

class SimplifyFraction

{    public static void main(String s[])
    {
        Fraction fraction = new Fraction(45, 55);
        System.out.println("The simplified factor is : " + simplify(fraction));

    }


public static Fraction simplify(Fraction fraction) {
//Write a code here to get the simplification of fraction and return it.
}
}
class Fraction {

int numerator;
int denominator;

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

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