Menu
Question Index
...

Write a program to get the product of all elements in an array.

Input (Integer Array) Output (Integer)
{2, 3, 4, 7, 6, 1} 1008
{3, 9, 1, 5, 4, 2} 1080



class ProductOfArrayElements
{
    public static void main(String s[])
    {
        int[] input = {2, 6, 3, 8, 1};
        int product = productOfArrayElements(input);
        System.out.println("Product of all elements in the array is : " + product);

    }


    public static int productOfArrayElements(int[] input)
    {
        int output = 1;
        return output;
    }

}

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