Find the number of consecutive zero at the end after multiplying n numbers | Function to count two 's factor ; Count number of 2 s present in n ; Function to count five 's  factor ; Function to count number of zeros ; Count the two 's factor  of n number ; Count the five 's factor  of n number ; Return the minimum ; Driver code
function two_factor ( n ) { let twocount = 0 ; while ( n % 2 == 0 ) { twocount ++ ; n = n / 2 ; } return twocount ; } function five_factor ( n ) { let fivecount = 0 ; while ( n % 5 == 0 ) { fivecount ++ ; n = n / 5 ; } return fivecount ; } function find_con_zero ( arr , n ) { let twocount = 0 ; let fivecount = 0 ; for ( let i = 0 ; i < n ; i ++ ) { twocount += two_factor ( arr [ i ] ) ; fivecount += five_factor ( arr [ i ] ) ; } if ( twocount < fivecount ) return twocount ; else return fivecount ; } let arr = [ 100 , 10 , 5 , 25 , 35 , 14 ] ; let n = 6 ; document . write ( find_con_zero ( arr , n ) ) ;