rank0001

Untitled

Nov 25th, 2021
369
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. def factorial(n):
  3.     if n < 0:
  4.         return 0
  5.     elif n == 0 or n == 1:
  6.         return 1
  7.     else:
  8.         fact = 1
  9.         while(n > 1):
  10.             fact *= n
  11.             n -= 1
  12.         return fact
  13. num = int(input())
  14. print(factorial(num))
  15.  
  16.  
  17.  
RAW Paste Data