logo CodeStepByStep logo

sentinel_sum

Write a complete console program that prompts the user for numbers until the user types -1, then outputs the sum of the numbers. Here is an example output:

Type a number: 10
Type a number: 20
Type a number: 30
Type a number: -1
Sum is 60
Complete program: Write an entire program that you could put into a file and run outside of CodeStepByStep.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.