## Python factorial calculation

DaLongggggg 2021-04-08 09:24:28
python factorial calculation

# Problem description

Enter a positive integer n, Output n! Value . among n!=123n.

# Algorithm description

n! It could be very big , The range of integers that a computer can represent is limited , We need to use the method of high precision calculation . Use an array A To represent a large integer a,A Express a A bit of ,A Express a Top ten , By analogy . take a Multiply by an integer k Change to array A Every element of the matrix is multiplied by k, Please pay attention to the corresponding carry . First of all, will a Set to 1, Then take 2, ride 3, When you get to n when , taken n! Value .

# Input format

The input contains a positive integer n,n<=1000.

# Output format

Output n! The exact value of .

10

# Sample output

3628800 Particular attention n First of all, recursion can only solve 1 Factorials up to a few hundred

``n = int(input())a = b =1while a <= n: b = b * a a += 1print(b)``

Cycle fatigue https://pythonmana.com/2021/04/20210408092140001l.html