Getting the number of trailing zeroes is like getting the number of times 10 is multiplied into the number.

For instance, in 100, there are two zeroes, corresponding to 10 times 10.

As another example, in 250, theres only 1 zero because there's only a single 10 in 250: 250 = 25*10.

In short, if we want to know the number of trailing zeroes, we simply have to account for the number of times 10 is multiplied into the number. Since 10 is just 5*2, we can simply count for the number of times 5 and 2 are multiplied. More simply, we could only count the number of 5 and its powers, since the 2 will just be taken from any even number.

Let's try a small factorial first: 5!

5! = 5 x 4 x 3 x 2 x 1 = 120

(so we know that it has one trailing zero)

Here's how we count that.

In 5! (or from 1 to 5) there's only a single multiple of 5 (and that is five itself). Hence, 5! has only one trailing 0.

Now, let's to that for 50!.

50! = 50 x 49 x ... x 4 x 3 x 2 x 1

How many 5's and powersof 5 do we have? (We consider the powers because they give an extra 5 --e.g. 25 is 5 raised to 2 so it will give another 5).