leetcode 172 Factorial Trailing Zeroes

https://leetcode.com/problems/factorial-trailing-zeroes/discuss/52371/My-one-line-solutions-in-3-languages

https://www.cnblogs.com/grandyang/p/4219878.html

class Solution {
public:
    int trailingZeroes(int n) {
        int num=0;
        while(n) {
            if(n/5) num+=n/5;
            n=n/5;
        }
        return num;
    }
};

 

posted @ 2020-04-15 10:07  qiujiejie  阅读(85)  评论(0编辑  收藏  举报