calculate LCM of two number (using java)

 class lcm

{

public static void main(String args[])

{

int a=10,b=4,LCM=0;

for(int i=Math.max(a,b); i<=a*b ; i++)

{

if(i%a==0 && i%b==0)

{

LCM=i

break;

}}

System.out.println(LCM);

}}

Comments

Popular posts from this blog