Question
JAVA Description This program will sum all the integers from a lower limit through an upper limit. It uses an initial loop to ensure a
JAVA
Description
This program will sum all the integers from a lower limit through an upper limit. It uses an initial loop to ensure a valid upper and lower bound are entered.
Requirements
Utilize a do-while loop to continue to prompt a user for a lower bound (integer) and upper bound (integer) until it is ensured that the upper bound is not less than the lower bound.
Once valid bounds are obtained, then use a for loop to calculate the sum from the lower bound through the upper bound.
Finally, display the sum.
You are required to match the exact output below, except your numbers may differ.
Sample Runs Run #1 Lower limit: 10 Upper limit: 1 Continues to loop until a valid upper and lower bound are entered. Lower limit: -3 Upper limit: -5 Lower limit: 2 Upper limit: 6 The sum from 2 through 6 is 20 Run #2 Lower limit: -3 Upper limit: 3 The sum from -3 through 3 is 0 Run #3 Lower limit: 2 Upper limit: 2 The sum from 2 through 2 is 2Step 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