Lcm General Method(least Common Multiple)
class Main
{
public static void main (String args[]){
int N=11;
int smallnum=22;
int Max=Math.max(N,smallnum);//MAX NUM SINCE WE CAN REDUCE NUMBER OF STEPS,,IF WE TAKE MINIMUM THE NUMBERS BETWEEN MIN AND MAX CANT BE MULTIPLE OF BOTH ,SO WE PROCEEDED WITH MAXIMUM NUMBER.
int multiple;
int i = 1;
while(Max>0)
{
multiple=i*Max;
if(multiple%smallnum==0)
{
System.out.println(multiple);
break;
}
i++;
}
}
}
[Success] Your code was executed successfully
22