Menu
Question Index
...


Write a program to get the Least Common Multiple (LCM) of an array of numbers.

Input (Integer Array) Output(Integer)
{5, 10, 15, 30, 17} 510
{24, 48, 64} 192
{14, 34, 51, 28} 1428
{18, 36} 36
{84} 84

class LCMOfArrayOfNumbers

{    public static void main(String s[])
    {
        int inputArray[] = {5, 10, 15, 30, 17};
        System.out.println("The Least Common Multiple is : " + getLcmOfAllElements(inputArray));

    }


public static int getLcmOfAllElements(int array[]) {
//Write code here to get the LCM of all the numbers in the array and return it.
}
}


Doubts

Problems

Topic: Learn Arrays And Loops

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App