write a program in java to input any two number and display its LCM
Answers
Answered by
0
Answer:
{
{ public static void main(String args[])
{ long n1,n2,i=2,lcm,b;
n1=Long. parseLong(args[0]); n2=Long. parseLong(args[1]);
if(n1>n2) lcm=n1;
else. lcm=n2;
b=lcm; while(lcm%n1!=0 || lcm%n2!=0)
{ lcm=b*i;
i++; }
}
system. out.printIn("LCM of " +n)
}
}
hope u like it
thank u
Similar questions