/**
* n! 多少个0
* 实际就是5的个数
*/
public class Zero {
public static int count(int n){
if(n < 1){
return -1;
}
int count = 0;
for(int i=1; i<=n; i++){
int m = i;
while(m%5 == 0){
count++;
m = m/5;
}
}
return count;
}
public static int count2(int n){
if(n < 1){
return -1;
}
int count = 0;
while(n>0){
int m = n;
while(m%5 == 0){
count++;
m = m/5;
}
n--;
}
return count;
}
public static int count3(int n){
if(n < 1){
return -1;
}
int count = 0;
while(n > 0){
count += n/5;
n = n/5;
}
return count;
}
public static long by(int n){
long m = 1;
while(n>0){
n--;
m *= (n+1)*n;
n--;
}
return m;
}
/**
* @param args
*/
public static void main(String[] args) {
int count = Zero.count(10);
int count2 = Zero.count2(10);
int count3 = Zero.count2(10);
long number = Zero.by(10);
System.out.println(number);
System.out.println(count);
System.out.println(count2);
System.out.println(count3);
}
}