Product of all Subarrays of an Array | C # program to find product of all subarray 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
using System ; class GFG { static void product_subarrays ( int [ ] arr , int n ) { int res = 1 ; for ( int i = 0 ; i < n ; i ++ ) { int product = 1 ; for ( int j = i ; j < n ; j ++ ) { product *= arr [ j ] ; res = res * product ; } } Console . WriteLine ( res + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 10 , 3 , 7 } ; int n = arr . Length ; product_subarrays ( arr , n ) ; } }