Question: PYTHON PROGRAM: using while loop Write a program that asks the user for a number n and prints the sum of the numbers 1 to

PYTHON PROGRAM: using while loop Write a program that asks the user for a number n and prints the sum of the numbers 1 to n. The program keeps asking for a number until the user enters 0.

ex:

enter an integer number (0 to end): 0 #stops here immediately
enter an integer number (0 to end): 1 1 = 1 #keeps asking for numer until user enters 0.
enter an integer number (0 to end): 5 1+2+3+4+5 = 15
enter an integer number (0 to end): 20 1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20 = 210
enter an integer number (0 to end): 0

# while n!=0 perhaps?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!