Hello coders, today we will be solving Small Factorials CodeChef Solution.
Problem
You are asked to calculate factorials of some small positive integers.
Input
An integer t, 1<=t<=100, denoting the number of testcases, followed by t lines, each containing a single integer n, 1<=n<=100.
Output
For each integer n given at input, display a line with the value of n!
Example
Sample Input
4 1 2 5 3
Sample Output
1 2 120 6
Solution - Small Factorials - CodeChef Solution
Python 3
#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))
Disclaimer: The above Problem (Small Factorials) is generated by CodeChef but the Solution is generated by Sloth Coders.
Happy Coding !!
A Sloth Who loves to Code
Also Read: