Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

Students also viewed these Programming questions

Question

a. What is the projects net present value?

Answered: 1 week ago