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))
Disclaimer: The above Problem (Small Factorial) is generated by CodeChef but the Solution is provided by CodingBroz. This tutorial is only for Educational and Learning purpose.