//Finding LCM of 3 Numbers of integer type
import java.util.*;
class lcm
{
public static void main(String arg[])
{
Scanner ob=new Scanner(System.in);
System.out.println("Enter 3 Numbers");
int a=ob.nextInt();
int b=ob.nextInt();
int c=ob.nextInt();
int i;
for(i=1; ;i++)
{
if(i%a==0 && i%b==0 && i%c==0)
break;
}
System.out.println("LCM is \t"+i);
}
}
/*
Input: Enter 3 Numbers
15
6
7
Output:
LCM is 210
Press any key to continue . . .
*/
Comments
Post a Comment