Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need to modify the following code so that instead, it calculates the mean of t

ID: 3640720 • Letter: I

Question

I need to modify the following code so that instead, it calculates the mean of two positive integers (n, n+1, n+2...m) where the user inputs the value for n and m. For example if the user inputs 2 and 9. the code would add 2+3+4+5+6+7+8+9/8 = 5.5

Here is the original code:

#include <iostream>
using namespace std;

int main ()
{
int value;
int total = 0;
int number;
float mean;

cout << "Please enter a positive integer" << endl;
cin >> value;

if (value > 0)
{
for (number = 1; number <= value; number++)
{
total = total + number;
}

mean = float(total) / value;

cout << "The mean average of the first " << value << " positive integers is " << mean << endl;
}

else
cout << "Invalid input - integer must be positive" << endl;

return 0;
}

Explanation / Answer

PS: Please rate the answer #include using namespace std; int main () { int m,n; int total = 0; int number; float mean; cout