Hacker Earth Practice Problems - Small Factorials


Problem Statement
You are asked to calculate factorials of some small positive integers.
Input
An integer T, denoting the number of testcases, followed by T lines, each containing a single integer N.
Output
For each integer N given at input, output a single line the value of N!
Input Constraint
1 <= T <= 100
1 <= N <= 100

Sample Input
4
1
2
5
3
Sample Output
1
2
120
6

Solution
Language: Python
import math
t = input()
while (t>0):
 t-=1
 a=input()
 print math.factorial(a)

Thanks for Visiting, Hope this helps you….

Comments

Popular Posts