Loading

Program to find the LCM of two numbers:                                                                                    

package quipoin.javaeasyprograms;
public class LCM {
    static int findHcf(int x, int y) {
        if(x==0)
            return y;
        else
            return findHcf(y%x,x);
    }
    static int findLCM(int x,int y){
        return (x*y)/findHcf(x,y);      // LCM*HCF = product of two number
    }
    public static void main(String[] args) {
        System.out.println(findLCM(5, 18));
    }
}

Output:

90