Write a program or function that finds the number of zeroes at the end of n!
in base 10, where n
is an input number (in any desired format).
It can be assumed that n
is a positive integer, meaning that n!
is also an integer. There are no zeroes after a decimal point in n!
. Also, it can be assumed that your programming language can handle the value of n
and n!
.
Test cases
1
==> 0
5
==> 1
100
==> 24
666
==> 165
2016
==> 502
1234567891011121314151617181920
==> 308641972752780328537904295461
This is code golf. Standard rules apply. The shortest code in bytes wins.
n!
would fit into your integer type! Well, maybe another time. \$\endgroup\$