SEP-PYTHON

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6 PROGRAM 7

PART B

PROGRAM B1 PROGRAM B2 PROGRAM B3 PROGRAM B4 PROGRAM B5 PROGRAM B6 PROGRAM B7 . . .

 
   
#6. Write a Program to find factorial of a number. 
-------------------------

import math 
num = int(input("Enter a number: ")) 
if num < 0: 
    print("Factorial doesn't exist for negative numbers") 
else:
    result = math.factorial(num) 
    print(f"Factorial of {num} is {result}") 

OUTPUT
----------------------------------