17.3---阶乘尾多少个0(CC150)
思路,其实这题easy,就是看多少个5.
答案:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
public static int getFactorSuffixZero(int n) { // write code here int res = 0; while(n != 0){ res += n / 5; n = n / 5; } return res; }
思路,其实这题easy,就是看多少个5.
答案:
public static int getFactorSuffixZero(int n) { // write code here int res = 0; while(n != 0){ res += n / 5; n = n / 5; } return res; }