Answer to Question #300961 in Python for cpxham

Question #300961

Write a program to enter the numbers till the user enter ZERO '0' and at the end it should display the sum of numbers entered.


1
Expert's answer
2022-02-22T01:10:34-0500
#Write a program to enter the numbers till the user enter ZERO '0' and at the end it should display the sum of numbers entered.


Sum = 0
n='1'


while(n!=0):
    n = int(input("Enter a non-zero number = "))
    Sum = Sum + n
print("\nSum of all numbers = ",Sum)

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
APPROVED BY CLIENTS