small-factorials

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

Source: hackerearth | Difficulty: EASY
Tags: Ad-hoc


Solutions:
import math
test = int(input())
while(test > 0):
	x = int(input())
	print(math.factorial(x))
	test = test - 1


#Factorial
n=int(input())
while n>0:
	var=int(input())
	ans=1
	while var>1:
		ans*=var
		var-=1
	print(ans)
	n-=1



t = eval(input())

for i in range(t):
	n = eval(input())
	prod = 1
	for j in range(1,n+1):
		prod = prod * j
	print(prod)



t = eval(input())

for i in range(t):
	n = eval(input())
	prod = 1
	for j in range(1,n+1):
		prod = prod * j
	print(prod)


t = eval(input())

for i in range(t):
	n = eval(input())
	prod = 1
	for j in range(1,n+1):
		prod = prod * j
	print(prod)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
kases = int(input())
for kase in range(kases):
	N = int(input())
	result = 1
	for i in range(1, N + 1):
		result = result * i
	print(result)


def fact(num):
	if num==0:
		return 1
	else:
		return num*fact(num-1)
cases=int(input())
while cases>0:
	num=int(input())
	print(fact(num))
	cases=cases-1


import sys

dict = {}
dict[1] = 1
dict[0] = 1

def fact(n):
	if n in dict:
		return dict[n]
	
	dict[n] = n * fact(n -1)
	return dict[n]

lines = [x.strip() for x in sys.stdin.readlines()]

for l in lines[1:]:
	print(fact(int(l)))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t =int(eval(input()))
for i in range(1,t+1):
	n =int(eval(input()))
	f=1
	for j in range(1,n+1):
		f=f*j
	print(f)



def f(n):
	if n == 1:
		return 1
	return n * f(n - 1)
t = eval(input())
while (t > 0):
	print(f(eval(input())))
	t -= 1


def fact(x):
	if(x==1):
		return 1
	else:
		return (x*fact(x-1))
t=eval(input())
while(t):
	t-=1
	x=eval(input())
	print(fact(x))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
def factorial(n):
	if n == 1:
		return n
	else:
		return n*factorial(n-1)
T=int(input())
if(T>=1 and T<=100):
    for i in range(1,T+1):
        num=int(input())
        if(num==0):
            print(1)
        else:
            a=factorial(num)
            print(a)
else:
	print('No. of test cases exceeds 100')


from math import factorial

for i in range(eval(input())):
 	z=int(input())
 	print(factorial(z))
 	


T=int(input().strip())
from math import factorial
for i in range(T):
	N=int(input().strip())
	print(factorial(N))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
def fact(number):
	if number == 1:
		return 1
	else:
		return number * fact(number-1)

no_of_input = int(eval(input()))
inputs = []
for i in range(1, no_of_input+1):
	number = int(eval(input()))
	inputs.append(number)

for i in inputs:
	print((fact(i)))


def f(n):
	if n == 1:
		return 1
	return n * f(n - 1)
t = eval(input())
while (t > 0):
	print(f(eval(input())))
	t -= 1


t = eval(input())
r = []
while(t):
	n = eval(input())
	mul = 1
	i = 1
	while(i<=n):
		mul = mul * i 
		i=i+1
	r.append(mul)
	t = t-1
for i in r:
	print(i)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
def fac(i):
	s=1
	for j in range(1,int(i)+1):
		s=s*j
	print(s)
n=eval(input())
for j in range(int(n)):
	k=eval(input())
	fac(k)



def fact(n):
	fact = 1
	for i in range(n,1,-1):
		fact *= i
		
	return fact        
		
T=int(eval(input()))
for i in range(T):
	print((fact(int(input()))))


def fact(num):
	if num == 0:
		return 1
	else:
		return num * fact(num-1)

i = (int)(input())
j = 0
while j < i:
	num = (int)(input())
	num = fact(num)
	print(num)
	j = j +1




T = int(input())
while T>0:
	F = 1
	N = int(input())
	while N>1:
		F *= N
		N = N-1
	print(F)
	T = T-1



from math import factorial

for i in range(eval(input())):
 	z=int(input())
 	print(factorial(z))
 	


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t = int(input())
a = []

for n in range(t):
	a.append(int(input()))

for i in range(t):
	summa = a[i]
	for j in range(a[i] - 1, 1 , -1):
		summa *= j
		
	print(summa)


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


import sys

inp=sys.stdin.read()

L=list(map(int, inp.split()))

fact=[]
prod=1
for x in range(1, 101):
	prod*=x
	fact.append(prod)
	
L=L[1:]

for x in L:
	print((fact[x-1]))
	
	



def fact(n):
	res=1
	for x in range(1,n+1):
		res*=x
	return res
t=int(input())
while(t>0):
	n=int(input())
	print(fact(n))
	t-=1


def fact(n):
	if n==0:
		return 1
	else:
		return n*fact(n-1)

n=eval(input())
l=[]
for i in range(n):
	l.append(eval(input()))
for i in l:
	print(fact(i))