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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply