text: Count divisors of array multiplication | C # program to count divisors in array multiplication . ; To count number of factors in a number ; Initialize count with 0 ; Increment count for every factor of the given number X . ; Return number of factors ; Returns number of divisors in array multiplication ; Multipliying all elements of the given array . ; Calling function which count number of factors of the number ; Driver code
code: using System ; class GFG { static int counDivisors ( int X ) { int count = 0 ; for ( int i = 1 ; i <= X ; ++ i ) { if ( X % i == 0 ) { count ++ ; } } return count ; } static int countDivisorsMult ( int [ ] arr , int n ) { int mul = 1 ; for ( int i = 0 ; i < n ; ++ i ) mul *= arr [ i ] ; return counDivisors ( mul ) ; } public static void Main ( ) { int [ ] arr = { 2 , 4 , 6 } ; int n = arr . Length ; Console . Write ( countDivisorsMult ( arr , n ) ) ; } }