I have this program below and my question is: Would I change the Total = Total + N; ?? I've tried changing it a few times but it won't give me 40 or 45. Does anyone have any reference codes for an example?
/*
Program: fixit2a - This program prompts for L and H and computes the Total
of the numbers between L and H inclusive.
Examples: L is 5 H is 10: Total: 45
L is 6 H is 10: Total: 40
The program does not work. Correct the program.
DO NOT DELETE OR ADD LINES.
You may modify lines, but DO NOT change while to for
*/
#include <iostream>
using namespace std;
int main(void)
{
int L, H, N, Total = 0;
cout << "Enter L and H: ";
cin >> L >> H;
N = 0;
while (N <= L)
{
Total = Total + N;
N = N + 1;
}