⌘BABAKOV.NET Let's code!
100% [dark] [ru]

Finding the number of trailing zeros in N!

A simple example of finding trailing zeros in the factorial of N.

    public int TrailingZeroes(int n) {
        int result = 0;
        while(n!=0){
            result += n/5;
            n = n/5;
        }
        return result;        
    }

Comments (0)

No comments yet.

Leave a comment
Comment
Images (up to 5 MB)
Your comment will appear after moderation.