Given an integer n, return the number of trailing zeroes in n!.
思路:5!= 120 则逢5 就会出现一个0;
public class Solution {
public int trailingZeroes(int n) {
int s = 0;
while (n>1) s += (n/=5);
return s;
}
}
Given an integer n, return the number of trailing zeroes in n!.
思路:5!= 120 则逢5 就会出现一个0;
public class Solution {
public int trailingZeroes(int n) {
int s = 0;
while (n>1) s += (n/=5);
return s;
}
}