LCM with java
/*
Easiest but slowest method
*/
class LCM
{
static void find_LCM(int num1, int num2)
{
System.out.println("Number 1: " + num1);
System.out.println("Number 2: " + num2);
long check_num = 1;
while (true)
{
if ((check_num%num1) == 0 && (check_num%num2) == 0)
{
long LCM = check_num;
System.out.println("The LCM is: " + LCM);
break;
}
else
++check_num;
}
}
}