#include using namespace std; int main() { int i{0}; int endValue{0}; int startValue{0}; cout << "Enter a positive value to stop at" << endl; cin >> endValue; i = 1; while ( i <= endValue) { cout << i << " "; i++; } cout << endl; cout << "In reverse" << endl; i = endValue; while ( i > 0 ) { cout << i << " "; i--; } cout << endl << endl; cout << "Enter a start value: "; cin >> startValue; //cout << "Starting at " << startValue << " ending at " << endValue << endl; if (startValue > endValue) { // count in reverse i = startValue; //cout << "Before the loop, i = " << i << endl; while (i >= endValue) { cout << i << " "; i--; } } else { // count forward i = startValue; while (i <= endValue) { cout << i << " "; i++; } } cout << endl; return 0; }