+91-85006-22255
Write a program to get the product of all elements in an array.
{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; } }
Topic: Learn Arrays And Loops
Read this topic Take test on this topic
Open In App