Exp 3 python

0

 Create a program that calculates the factorial of a number entered by the used using loop in python


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

factorial = 1


if number < 0:

    print("Factorial does not exist for negative numbers")

elif number == 0:

    print("The factorial of 0 is 1")

else:

    for i in range(1, number + 1):

        factorial *= i

    print("The factorial of", number, "is", factorial)

Post a Comment

0Comments

GUYS IF YOU HAVE ANY DOUBT. PLEASE LET ME KNOW

Post a Comment (0)