Find product of all elements in an array - Java Quiz Question


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;
    }

}