Product of all non repeating Subarrays of an Array | C # program to find the product of all non - repeating Subarrays of an Array ; Function to find the product of all non - repeating Subarrays of an Array ; Finding the occurrence of every element ; Iterating through the array and finding the product ; We are taking the power of each element in array with the occurrence and then taking product of those . ; Driver code
using System ; class GFG { private static long product ( int [ ] arr ) { double occurrence = Math . Pow ( 2 , arr . Length - 1 ) ; double product = 1 ; for ( int i = 0 ; i < arr . Length ; i ++ ) { product *= Math . Pow ( arr [ i ] , occurrence ) ; } return ( long ) product ; } public static void Main ( String [ ] args ) { int [ ] arr = { 10 , 3 , 7 } ; Console . WriteLine ( product ( arr ) ) ; } }