Answered step by step
Verified Expert Solution
Question
1 Approved Answer
solve in java PoD 8.1: Sum fun! (While Loops to Calculate Sums)/ 1. Sum fun! Instructions Today we are working with loops. We will use
solve in java
PoD 8.1: Sum fun! (While Loops to Calculate Sums)/
1. Sum fun!
Instructions
Today we are working with loops. We will use a while loop to calculate the sum of a series of numbers.
Details
Input
The program reads in the following:
- integer values (unknown quantity, each on their own line)
- followed by one empty line (empty string \"\") -->
Processing
Sum of values algorithm:
- Initializetotalto 0
- Read in a value
- Usewhileloop to look for sentinel, each time through the loop:
- Add entered value tototal
- Read in another value
Output
Output the sum of the values.
Sample input/output:
Input | Output |
3 4 5 \" \" | The sum of the values is 12. |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started