Question: 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
Get step-by-step solutions from verified subject matter experts
