Product number in the array

PHOTO EMBED

Mon May 29 2023 18:26:20 GMT+0000 (Coordinated Universal Time)

Saved by @Mohamedshariif #java

public static void main(String[] args) {
		int[] array = {1,2,3,4,5};
		
		int myPro = product(array);
		
		System.out.println("The Product numbers in the array are = " + myPro);
		
	}
	public static int product(int[]array) {
		int product = 1;
		for(int i=0; i<array.length; i++) {
			product = product * array[i];
		}
		return product;
	}
}
//output: 
The Product numbers in the array are = 120
content_copyCOPY