Preview:
public class mayank {
    public static void main(String[] args) {
        System.out.println("Enter the numbers");
        Scanner sc =new Scanner(System.in);
        int a = sc.nextInt();
        int b= sc.nextInt();
        int gcd=0;
        for (int i=1;i<=a || i<=b;i++){
            if (a%i ==0 && b%i==0){
                gcd = i;
            }
        }
        int lcm = (a*b) /gcd;
        System.out.println(lcm);

        /*int hcf=0;
        for (int i =1;i<=a||i<=b;i++){
            if(a%i==0 && b%i==0){
                hcf =i;
            }

        }
        System.out.println(hcf);*/
    }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter