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);
}
}
Showing posts with label Common. Show all posts
Showing posts with label Common. Show all posts
Wednesday, January 16, 2008
Subscribe to:
Posts (Atom)