/** * Created by hzhou on 4/24/15. [email protected] */ publicclassFactorialTrailingZeroes{ publicinttrailingZeroes(int n){ if (n <= 0) { return0; } int result = 0; long factor = 5; while (n / factor > 0) { result += n / factor; factor *= 5; } return result; } }