Read through this program carefully and try to analyze what is going on in each line of code (each line of code is performing more than one task).
n = 6
fact = 1
if n < 0:
print("No factorial")
elif n == 0:
print("The factorial= 0")
else:
for i in range(1,n + 1):
fact = fact*i
print("The factorial= ",fact)
Comments
Leave a comment