阶乘产生0
public class 阶乘尾数0的个数 {
public static void main(String[] args) {
int a;
int count = 0;
for (a = 5; a <= 100; a += 5) //循环从5开始,以5的倍数为步长,考察整数
{
count++; //若为5的倍数,计数器加1
if (a%25==0) {
count++;
};
//若为25的倍数,计数器再加1
}
System.out.println("The number of 0 in the end of 100! is:"+count);
}
}
的条件:若为5的倍数,则含有一个0,若为25 的倍数则含有2个0。