Leaderboard
Showing:
Sum of digits in factorial of a number
Easy Accuracy: 22.5% Submissions: 805 Points: 2

Given a number n, write code to find the sum of digits in the factorial of the number.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer n, the number.

Output:
Print the sum of digits in the factorial of the number.

Constraints:
1<=T<=1000
1<=n<=5000

Example:
Input:

2
10
100

Output:
27
648

to report an issue on this page.

Editorial

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

Yes

All Submissions

My Submissions:

Login to access your submissions.

Sum of digits in factorial of a number

Output Window