Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python

n = int(input('Type a number, and its factorial will be printed: '))

if n < 0:
    raise ValueError('You must enter a non negative integer')

fact = 1

for i in range(2, n + 1):
    fact *= i

print(fact)
Source by www.python.org #
 
PREVIOUS NEXT
Tagged: #python
ADD COMMENT
Topic
Name
7+4 =