Question
Write a program in C++ to print the sum of the integers between m and n , inclusive. With an m of 3 and an
Write a program in C++ to print the sum of the integers between m and n, inclusive. With an m of 3 and an n of 5, the sum is 12. Use a for loop to compute the sum.
Have main( ) continue to prompt the user for input using a do-while loop until she enters valid input values, i.e., m < n.
Run your program using the following test cases:
1. m greater than n
2. m equal to n
3. m less than n
Sample output: The sum of the numbers between 3 and 5 is 12.
Turn in printouts of your program listing and the output. Make sure that your full name is on all of your printouts. Staple the assignment sheet to the top of your program.
As before, part of your grade will be based on the proper use of:
1. meaningful variable names
2. consistent indentation
3. blank lines and spacing
4. comments on the following:
- program description
- section descriptions
- all variable declarations
5. local variables (versus global variables)
6. format and appearance of output
7. structured code (e.g., no goto, break (except in a switch), continue, etc. statements)
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