public int TrailingZeroes(int n)
{
int count = 0;
while (n > 0)
{
count += n/5;
n /= 5;
}
return count;
}
C#  same as others

My implementation is negligibly more efficient and includes an inadequate explanation of how the algorithm works.
public int TrailingZeroes(int n) { int trailingZeroes = 0; // The basic underlying principle is that: // Every fifth number can be multiplied with a two (which are a dimeadozen) to create another trailing zero. while (n > 1) { n = n / 5; trailingZeroes += n; } return trailingZeroes; }