# Compute n-factorial for a value of n entered by the user # Read the value of n from the user n = int(input("Enter an integer (0 or greater): ")) # Initialize factor and product product = 1 factor = n # Compute the factorial by performing one multiplication per loop iteration # While the factor is greater than 0 while factor > 1: # Multiply the product by the factor product = product * factor # Reduce factor by 1 factor = factor - 1 # Display the result print(n, "factorial is equal to", product)