Question__7

PHOTO EMBED

Tue May 16 2023 18:58:29 GMT+0000 (Coordinated Universal Time)

Saved by @Mohamedshariif #java

//Write a Java method that takes in an array of doubles and returns the product of all the doubles in the array.

public static void main(String[] args) {
		
		double[] Array1 = {2.9, 2.5, 5.6};
		double myProduct = products(Array1);
		System.out.printf("Product of array1 = %.2f " , myProduct);
		System.out.println();
}
public static double products(double[]arr) {
		double product = arr[0] * arr[1] * arr[2];
		for(int i=1;i<arr.length;i++) {
		}
		return product;
	}

//output 
Product of array1 = 40.60 
content_copyCOPY