Lcm Using Gcd(euclid)(optimal Method)

class Main
{
    public static void lcm(int A ,int B)
    {
        int a =A;
        int b=B;
        int gcd=1;
        int lcm;
        int product=a*b;
        while(a!=0)
        {
            int a_=b%a;
            int b_=a;
            a=a_;
            b=b_;
        }
        gcd=b;


        lcm=(product)/(gcd);
        System.out.println(lcm);
    }
    public static void main(String args[])
    {
        lcm(20,10);
    }
}

[Success] Your code was executed successfully

20