```
n = 7
# uncomment to take input from the user
#n = int(input("Enter a number: "))
fact = 1
# check if the number is negative, positive or zero
if n < 0:
print("Factorial does not exist for negative numbers")
elif n == 0:
print("The factorial of 0 is 1")
else:
for i in range(1,n + 1):
fact = fact*i
print("The factorial of",n,"is",fact)
```

```
OUTPUT:
The factorial of 7 is 5040
```

## No comments:

## Post a Comment