Write an algorithm which computes the number of trailing zeros in n factorial.
Example
11! = 39916800, so the out should be 2
class Solution {
public:
// param n : description of n
// return: description of return
long long trailingZeros(long long n) {
long long num_of_zero = 0;
while (n >= 5) {
n/=5;
num_of_zero+=n;
}
return num_of_zero;
}
};