Question: Write a program using a while statement, that given a series of numbers as input, adds them up until the user inputs a negative number

Write a program using a while statement, that given a series of numbers as input, adds them up until the user inputs a negative number and then prints the total. Do not add the final negative number. For example, if the following numbers are input 8 3 11 -1 The output should be: 22 Snidmi: Value: 8 Value: 3 Value: 11 Value: -1 Total: 22 Value: 23 Value: 42 Value: 12 Value: -1 Total: 77 Value: 2 Value: 2 Value: 2 Value: 2 Value: -10 Total: 8 Value: -5 Total: 0 Value: 1 Value: 2 Value: 3 Value: 4 Value: 5 Value: -2 Total: 15

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!