Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions