Design a program with a loop that asks the user to enter a series of positive numbers. The user should enter a negative number to signal the end of the series. After all the positive numbers have been entered, the program should display the sum of all EVEN numbers.
Added by Keith B.
Step 1
Start by initializing a variable called "sum" to 0. This variable will keep track of the sum of all even numbers entered by the user. Show more…
Show all steps
Your feedback will help us improve your experience
Shelayah Robinson and 64 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Design a program with a loop that asks the user to enter a series of positive numbers. The user should enter a negative number to signal the end of the series. After all the positive numbers have been entered, the program should display their sum.
Shelayah R.
Write a program with a loop that asks the user to enter a series of positive numbers. The user should enter a negative number to signal the end of the series. After all the positive numbers have been entered, the program should display their sum. Note: Don't include the negative number in the sum. Pay attention to the fact that, as a programmer, you have no idea how many positive numbers the user is going to enter. Pick your loop wisely. Design your code your way!!
Sum of Numbers Problem Please examine the text provided thoroughly to identify and correct any spelling, typographical, grammatical, OCR (optical character recognition), and mathematical errors, including any errors related to the square root symbol. Ensure that the entire text is properly formatted and presented in a clear, coherent manner. Only correct errors. Do not answer it.
Aarya B.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD