```
class Solution {
public:
int trailingZeroes(int n) {
int divi = 1;
int expo = log( n ) / log( 5 );
for( int i = 0; i < expo; i++ )
divi *= 5;
int count = 0;
int used = 0;
int quot = 0;
for( int j = divi; divi > 1; divi /= 5 )
{
quot = n / divi;
count += ( quot - used ) * expo;
used = quot;
expo--;
}
return count;
}
};
```