i want to find the lcm ,cant it be found without using gcd?
class Gcd
{ int a,b;
Gcd(int a,int b )
{
this.b=b;
this.a=a;
}
int gcd( int a,int b)
{
while(a!=b)
{
if(a>b)
a=a-b;
else
b=b-a;
return a;
}
}
int lcm()
{
int l;
if(a<b)
l=(a*b)/gcd(a,b);
else
l=(a*b)/gcd(a,b);
return l;
}
public static void main(String[] args)
{
Gcd g =new Gcd(10,5);
//g.gcd()
System.out.println("gcd is"+g.lcm());
}
}