Aug-22-2020, 05:52 PM
(This post was last modified: Aug-22-2020, 07:57 PM by Gribouillis.)
1.n = int(input())
2.
3.factorial = 1
4.while n > 1:
5.
6. factorial *= n
7. n -= 1
8.
9.print(factorial)
10.
11.#I would like to write a code where I could repeat the action endlessly and ask the user for the number he wants to find the factorial. I've tried both "break" and "continue", just in the book I'm reading a summary of "while". I also wanted to write "input", but the code did not work
2.
3.factorial = 1
4.while n > 1:
5.
6. factorial *= n
7. n -= 1
8.
9.print(factorial)
10.
11.#I would like to write a code where I could repeat the action endlessly and ask the user for the number he wants to find the factorial. I've tried both "break" and "continue", just in the book I'm reading a summary of "while". I also wanted to write "input", but the code did not work