LCM - Program find out least common multiple

package day1; public class LCM { public static void main(String[] args) { // TODO Auto-generated method stub int no1 = 3; int no2 = 517; int big = 0; if (no1>no2) big = no1; else big = no2; while(true) { if(big%no1==0 && big%no2==0) { System.out.println("LCM is " +big); break; } big= big+1; }}} out put === LCM is 1551

Feb 11, 2025 - 05:54
 0
LCM - Program find out least common multiple

package day1;

public class LCM {

public static void main(String[] args) {
    // TODO Auto-generated method stub
 int no1 = 3;
 int no2 = 517;
 int big = 0; 
 if (no1>no2)
     big = no1;
 else 
     big = no2;

 while(true) {
    if(big%no1==0 && big%no2==0)
     {
         System.out.println("LCM is " +big);
         break;          
     }
 big= big+1;                 
}}}

out put === LCM is 1551