Trailing Zeros

Learn to write the code for counting the number of trailing zeros at the end of a factorial.

Challenge

Write a function called countTrailingZeros (int X) that determines the number of trailing zeros at the end of X! (X factorial), where X is an arbitrary input from the user.

Note: In case of a negative number X, your program should return -1.

Example 1

Input: 12

12! = 479001600

Number of zeros at the end of 12! = 2

Example 2

Input: 5

5! = 120

Number of zeros at the end of 5! = 1 ...