Skip to main content

Posts

Showing posts with the label factorial of number

python program for factorial of given number.

def factorial(n):     if n == 0 or n == 1:         return 1     else:         return n * factorial(n-1) # Input: Enter the value of 'num' to calculate the factorial for a different number num = int(input("Enter a positive Integer"))  if(num>=0)  result = factorial(num) print("The factorial of {num} is: {result}")