What’s up coders, today we are going to solve Small Factorial CodeChef Solution whose Problem code is FLOW018.
You are asked to calculate factorials of some small positive integers.
An integer t, 1<=t<=100, denoting the number of testcases, followed by t lines, each containing a single integer n, 1<=n<=100.
For each integer n given at input, display a line with the value of n!
4 1 2 5 3
1 2 120 6
Solution – Small Factorial – CodeChef Solution
#Solution provided by Sloth Coders def factorial(n): if n == 0: return 0 elif n == 1: return 1 else: return n * factorial(n - 1) n = int(input()) for i in range(n): num = int(input()) print(factorial(num))