39) Write a program to input two integers
and find the LCM of two numbers?(10,12..LCM=60
)
import java.util.*;
public class LCM
{
public static void main(String args[ ])
{
Scanner sc = new Scanner (System.in);
System.out.println("Enter two numbers");
int a = sc.nextInt();
int b = sc.nextInt();
for(int i = Math.max(a,b);i<a*b;i++)
{
if(i%a==0&&i%b==0)
{
System.out.println("L.C.M of "+a+" and "+b+" = "+i);
break;
}
}
}}