Answer to Question #261370 in Python for tatestats

Question #261370

Write a program that asks the user for an integer greater than 0 and then use a for-loop to


calculate the factorial of that positive integer.


Modify your program so that the output looks like the following:


Example: 5! = 5 x 4 x 3 x 2 x 1 = 120


1
Expert's answer
2021-11-05T00:34:05-0400
n = int(input("enter a number greater than 0: "))
factorial = 1 
for i in range(1, n + 1):
    factorial = factorial * i
print("factorial of ", n, " is ", factorial)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog