lcm of two no
public class LCMUsingGCD
{
public static void main(String[] args)
{
int num1 = 15, num2 = 25, gcd = 1;
for(int a = 1; a <= num1 && a <= num2; ++a)
{
if(num1 % a == 0 && num2 % a == 0)
{
gcd = a;
}
}
int lcm = (num1 * num2) / gcd;
System.out.println("LCM of " + num1 + " and " + num2 + " is " + lcm + ".");
}
}