import java.io.*;
class lowhigh
{
public static void main(String args[])throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int a,b,c,i,j,t,k,p,lcm,hcf=1;
System.out.println(" Enter any 3 number ");
a = Integer.parseInt(br.readLine());
b = Integer.parseInt(br.readLine());
c = Integer.parseInt(br.readLine());
p = a*b*c;
for(i=1;i<=p;i++)
{
j = a%i;
t = b%i;
k = c%i;
if(j==0&&t==0&&k==0)
{
hcf = i;
}
}
lcm = p/hcf;
System.out.println(" the lcm is " + lcm);
System.out.println(" the hcf is " + hcf);
}
}
Subscribe to:
Post Comments (Atom)
2 comments:
rocking boss, it helped me a lot!!!
Thanks gi,It's great :)
Post a Comment