# # Compute n-factorial for some n entered by the user using a for loop. # # Read n from the user. n = int(input("Enter an integer: ")) # Initialize result to 1. result = 1 # For each value for 1 to and including n. for i in range(1, n+1): # Multiply the current value by the result so far. result = i * result # Display the result. print(n, "factorial is equal to", result)