LCM stands for least common multiple. The least common multiple of two numbers is the smallest number that is a multiple of both of them.

Program:-
package forloop;
public class LCM {
public static void main(String[] args)
{
int div= 2;
int no1=100,no2=120;
int small= no1<no2? no1:no2;
for(div=2; div<=small; div++)
{
if(no1%div==0 && no2%div==0)
{
System.out.println(div);
}
}
}
}
Output Screenshot:-
