找出n的阶乘末尾有几个零
原理:因为10由2*5组成,而构成2的因数比5多 所以最终转换成求5的个数
int getNumber(int n)
{
int count = 0;
while(n)
{
n = n/5;
count = count +n;
}
return count;
}
一切源于对计算机的热爱
原理:因为10由2*5组成,而构成2的因数比5多 所以最终转换成求5的个数
int getNumber(int n)
{
int count = 0;
while(n)
{
n = n/5;
count = count +n;
}
return count;
}