Given any positive integer, we want to know how many trailing 0s does it have.
Example
1000 Ans. 3
4500 Ans 2
Solution
In order to find this we just need to see how many times the number can be divided by 5
public class Solution {
public int TrailingZeroes(int n) {
int count = 0;
while (n > 0) {
n /= 5;
count += n;
}
return count;
}
}