Mid-Term Quiz 2. Develop a C++ program that prompts the user to enter a start number and an end number.
//The program calculate the summation of the numbers.
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int start = 0;
int end = 0;
int sum;
cout << "Enter the start number: \n";
cin >> start;
while(start !=0)
{
cout << "Enter the end number: \n";
cin >> end;
if(end == 0)
break;
else
if(end > start)
cout << "Start number must be bigger than the end number"<<endl;
break;
for (int i = start; i <= end; i++)
sum += i;
cout << "The total of all integers from " << start << " to " << end << " is " << sum << endl;
sum = 0;
cout << "Enter the start number: ";
cin >> start;
}
system("pause");
return 0;
}