Associated Course(s):
Geeks Classes
Geeks Classes DSA- Tutorials

Given an integer **N**. The task is to find the number of digits that appear in its factorial, where factorial is defined as, factorial(n) = 1*2*3*4……..*N and factorial(0) = 1.

**Input:**

The first line of input contains a single integer T denoting the number of test cases. Then** **T test cases follow. Each test case consist of one line. The first line of each test case consists of an integer N.

**Output:**

Corresponding to each test case, in a new line, print the number of digits that appear in its factorial.

**Constraints:**

1 ≤ T ≤ 100

1 ≤ N ≤ 10^{4}

**Example:**

**Input**:

2

5

120

**Output**:

3

199

**Explanation:
Testcase 1:** Factorial of 5 is 120. Number of digits in 120 is 3 (1, 2, and 0).

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

saiujwal13083 | 347 |

isiddhisingh | 252 |

Abhishek_Jadhav | 243 |

_uncle_sam_ | 221 |

c_ocoooo | 217 |

saiujwal13083 | 610 |

SumitSingh27 | 466 |

c_ocoooo | 456 |

rathiarpit29 | 379 |

NaveenKumarNakka | 370 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4931 |

Quandray | 4598 |

Login to report an issue on this page.