1*2*3*......*3000相乘结果的末尾有多少个0?

  1*2*3*......*3000相乘结果的末尾有多少个0?


 1 public class CountZeroDemo {
 2     public static void main(String[] args) {
 3         System.out.println(countZero(3000));//748
 4     }
 5     private static int countZero(int n){
 6         int count=0;
 7         int j;
 8         for(int i=1;i<=n;i++){
 9             j=i;
10             while(j%5==0){
11                 count++;
12                 j/=5;
13             }
14         }
15         return count;
16     }
17 }

  结果:748

原文地址:https://www.cnblogs.com/gw811/p/2730945.html