Product of all Subarrays of an Array | Function to find product of all subarrays ; Variable to store the product ; Compute the product while traversing for subarrays ; Printing product of all subarray ; Driver code ; Function call
function product_subarrays ( arr , n ) { let product = 1 ; for ( let i = 0 ; i < n ; i ++ ) { for ( let j = i ; j < n ; j ++ ) { for ( let k = i ; k <= j ; k ++ ) product *= arr [ k ] ; } } document . write ( product + " " ) ; } let arr = [ 10 , 3 , 7 ] ; let n = arr . length ; product_subarrays ( arr , n ) ;