[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/githubanalyzeruser/Java-Programs/master/MathPrograms/LCM.java [Back]  [Original]

package MathPrograms;

import MathPrograms.GCDEuclid;
import trick.FastReader;

public class LCM {

	public static void main(String[] args) {
		FastReader sc=new FastReader();
		System.out.println("Enter the number: ");
		int a=sc.nextInt();
		int b=sc.nextInt();
		int hcf=GCDEuclid.gcd(a, b);
		int lcm=(a*b)/hcf;
		System.out.println("LCM of ("+a+", "+b+") = "+lcm);
	}
}

Web Proxy Viewer  |  New URL  |  Original Page