Saturday, February 19, 2011

LCM of two numbers in java



Java code to find the LCM i.e. least common factors of given two numbers




import java.io.*;




class Test {

public static void main(String[] args) throws IOException {



int n1,n2,x,y;

System.out.println("Enter first number:");

BufferedReader br1=new BufferedReader(new InputStreamReader (System.in));

n1=Integer.parseInt(br1.readLine());

No comments:

Post a Comment