Page 1 of 1

Write a Python program to finish the following tasks: 1) Ask user input a positive integer n (n > 0). If the input integ

Posted: Sat May 14, 2022 4:21 pm
by answerhappygod
Write a Python program to finish the following tasks:
1) Ask user input a positive integer n (n > 0). If the input
integer is <= 0, ask
user input again until n > 0.
2) Use loop to calculate the factorial n! = 1 * 2 * ... * n and the
Sum = 1 + 2 +
... + n
3) Calculate and output the difference between n! and Sum, i.e. n!
- Sum.
In Python code please