Help with input output on Factorial Easy Problem

Hey I am starting to tackle the factorial problem, but I do not understand the example input and output that are given as example. Can someone help me understand how the two correlate, please?

Sample Input:
6
3
60
100
1024
23456
8735373
Sample Output:
0
14
24
253
5861
2183837

What you need to do is => Find the Number of Trailing Zeroes at the end of N!

T on the first line of input (in this case 6) stands for the number of numbers to follow i.e., number of test cases.

Then there are T lines, each containing exactly one positive integer number N (1 <= N <= 1000000000) .

Now you need to output the total number of 0’s at occurring at the end of each N i.e., for each test cases.

Sample Input:

6 ( this is the value of T)

3 (this and the following are values of N)

60

100

1024

23456

8735373

Sample Output:

0 ( factorial of 3 = 6, so there are no trailing 0’s at the end , so answer for this case is 0)

14 ( factorial of 60 has 14 (fourteen) 0’s at the end and similarly calculate for the rest)

24

253

5861

2183837

You can check the editorial explanation for further information here.

@snowpeak:

Refer the below wikipedia link given… it is the best source and helps u in understanding all the concepts related to your question

1 Like