Question: For this daily, write a program that will calculate and display the sum of the values between a lower and upper bound, inclusive. A CPP
For this daily, write a program that will calculate and display the sum of the values between a lower and upper
bound, inclusive.
A CPP file sumboundary.cpp has been provided. It contains the declaration for an integer variable lower the
declaration for a second integer variable upper code that will ask the user to enter the lower bound, and code
that will ask the user to enter the upper bound.
Add code that will check that the lower and upper bounds are valid. To be valid, the lower bound must be less
than or equal to the upper bound. If the boundary values are invalid, swap the boundary values and display a
message that the boundary values have been swapped. The message that is displayed MUST match the message
that is displayed in the output below print a new line at the beginning and end of the message
Once the boundary values are valid, calculate the sum of the values between the lower and upper bounds,
inclusive. Display the sum as follows:
The sum of the values between lowerbound and upperbound is result
where lowerbound is the valid lower bound value, upperbound is the valid upper bound value, and result is
the calculated sum.
Print a new line at the beginning and end of the output.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
