Count trailing zeroes in factorial of a number | Function to return trailing 0 s in factorial of n ; Initialize result ; Keep dividing n by powers of 5 and update count ; Driver Code
< ? php function findTrailingZeros ( $ n ) { $ count = 0 ; for ( $ i = 5 ; $ n / $ i >= 1 ; $ i *= 5 ) $ count += $ n / $ i ; return $ count ; } $ n = 100 ; echo " Count ▁ of ▁ trailing ▁ 0s ▁ in ▁ " , 100 , " ! ▁ is ▁ " , findTrailingZeros ( $ n ) ; ? >