Count the factors of K present in the given Array | Function to find the count of factors of K present in array ; Loop to consider every element of array ; Driver Code ; Function Call
function calcCount ( arr , n , k ) { var count = 0 ; for ( var i = 0 ; i < n ; i ++ ) { if ( k % arr [ i ] == 0 ) count ++ ; } return count ; } var arr = [ 1 , 2 , 4 , 5 , 6 ] ; var n = arr . length ; var k = 6 ; document . write ( calcCount ( arr , n , k ) ) ;