LCM of multiple number.

WAP to find LCM of multiple number.

import java.util.Scanner; class L18LCM { public static void main() { int x,flag=0,lcm=1; System.out.println("Enter the number integers to calculate their Lowest Common Multiple"); Scanner in = new Scanner(System.in); x = in.nextInt(); int [] a=new int[x]; for(int i=0;i<x;i++) { System.out.print(" \n Enter Integer "+(i+1) + "\t"); a[i]=in.nextInt(); // store in value input by user in array } for(;flag<x;lcm++) { flag=0; for(int i=0;i<x;i++) { if (lcm % a[i]==0) flag ++; } } System.out.println("\n Lowest Common Multiple of given integers is "+(lcm-1)); } }





For Any Desired Program comment below. WE WILL TRY OUR BEST TO MAKE THAT PROGRAM AVAILABLE.

Comments

Popular Posts