# Find extra long factorials in python

Carvia Tech | September 03, 2019 | 1 min read | 248 views |

The factorial of the integer n, written n!, is defined as:

n! = n*(n-1)*(n-2)*..*3*2*1

Calculate and print the factorial of a given integer.

Input Format

Input consists of a single integer n.

Constraints
1<=n<=100
Output Format

Print the factorial of n.

Sample Input
25
Sample Output
15511210043330985984000000

Explanation

25! = 25*24*23*22*...*3*2*1

## Solution

Note

This answer passes all the tests

We are going to keep logic in main function only such that we are able to build array as we will be getting data from input. You shall create a script.py file and paste the below code in it.

1st line: arr = int(input()) This takes input from command line. Please note that input type is going to be in string format and we have to use int() to convert from string to int

2nd line: a=1 This is to intialize the number.

Finding extra long factorial of a number: python
if __name__ == '__main__':
arr = int(input())
a = 1
for i in range(1,arr+1):
a = a*i
print(a)

###### Find more on this topic: ##### Machine Learning

Data science, machine learning, python, R, big data, spark, the Jupyter notebook, and much more

Last updated 1 week ago

###### Recommended books for interview preparation:
Book you may be interested in..
Book you may be interested in..