Count the factors of K present in the given Array | C # implementation to find the count of factors of K present in array ; Function to find the count of factors of K present in array ; Loop to consider every element of array ; Driver Code ; Function Call
using System ; class GFG { static int calcCount ( int [ ] arr , int n , int k ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( k % arr [ i ] == 0 ) count ++ ; } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 4 , 5 , 6 } ; int n = arr . Length ; int k = 6 ; Console . Write ( calcCount ( arr , n , k ) ) ; } }