Computer Science, asked by tusharmishra30112002, 9 months ago

Write a python program to print the factorial of the given no.

Answers

Answered by dshkkooner1122
9
  1. num = int(input("Enter a number: "))
  2. factorial = 1.
  3. if num < 0:
  4. print("Sorry, factorial does not exist for negative numbers")
  5. elif num == 0:
  6. print("The factorial of 0 is 1")
  7. else:
  8. for i in range(1,num + 1):

Answered by gaganadithyareddy9
3

Answer:

Hey! Here is your code in python...

def factorial(n):

   prod = 1

   

   while n>=1:

       prod*=n

       n = n-1

       

   return prod

x = int(input("Enter a number: "))

f = factorial(15)

print("Factorial of", x, '=', f)

# HOPE THIS HELPS!!

Similar questions