Geeksforgeeks

Error

For an integer **N** find the number of trailing zeroes in **N!.**

**Example 1:**

Input:N = 5Output:1Explanation:5! = 120 so the number of trailing zero is 1.

**Example 2:**

Input:N = 4Output:0Explanation:4! = 24 so the number of trailing zero is 0.

**Your Task: **

You don't need to read input or print anything. Your task is to complete the function **trailingZeroes()** which take an integer N as an input parameter and returns the count of trailing zeroes in the N!.

**Expected Time Complexity:** O(logN)

**Expected Auxiliary Space:** O(1)

**Constraints:**

1 <= N <= 10^{9}

We are replacing the old Disqus forum with the new Discussions section given below.

Click here to view old Disqus comments.

Click here to view old Disqus comments.

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

YesLoading...

Trailing zeroes in factorial

...