Factorials
Coding Problem Keys
Factorials
Problem Statement
Given 'n' (1 <= n <= 100), find the factorial of 'n'.
The factorial of 'n' is defined as the product of all integers from 1 to 'n'.
Input Specification
Any number 'n' from range of 1 to 100.
Output Format
Return a string containing the factorial.
Example 1
Input 1
5
Sample Output 1
120
Explanation
5! = 5 x 4 x 3 x 2 x 1 = 120.
The returned number is 120.
Example 2
Input 2
7
Sample Output 2
5040
Solution
Programming Language: Python 3 Language
# Published By PKJCODERSn=int(input()) fact=1 for i in range(1,n+1): fact*=i print(fact)
(Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.)
Comments