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
< ? php function two_factor ( $ n ) { $ twocount = 0 ; while ( $ n % 2 == 0 ) { $ twocount ++ ; $ n = ( int ) ( $ n / 2 ) ; } return $ twocount ; } function five_factor ( $ n ) { $ fivecount = 0 ; while ( $ n % 5 == 0 ) { $ fivecount ++ ; $ n = ( int ) ( $ n / 5 ) ; } return $ fivecount ; } function find_con_zero ( $ arr , $ n ) { $ twocount = 0 ; $ fivecount = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { $ twocount += two_factor ( $ arr [ $ i ] ) ; $ fivecount += five_factor ( $ arr [ $ i ] ) ; } if ( $ twocount < $ fivecount ) return $ twocount ; else return $ fivecount ; } $ arr = array ( 100 , 10 , 5 , 25 , 35 , 14 ) ; $ n = 6 ; echo find_con_zero ( $ arr , $ n ) ; ? >