Hello, basically I'm trying to write a program where you ask the user to input 2 positive number. Then the program will print the lower of the two numbers to the higher of the 2 numbers and then higher of the 2 numbers to the lower of the 2 numbers.
I got it to print the numbers from low to high but I can't get it to print from high to low(reverse order)
example - user inputs 2 and 8
output - 2 3 4 5 6 7 8
8 7 6 5 4 3 2(reverse order)
#include <iostream>
using namespace std;
int main()
{
int num1 = -1;
int num2 = -1;
while(num1 < 0)
{
cout << "please enter a positive integer: "; //asks the user to input number
cin >> num1;
}
while (num2 < 0)
{
cout<<"Please enter your second positive number: "; // asks the user to input second number
cin >> num2;
}
while(num1<=num2) //prints number from low to high
{
cout<<num1;
num1++;
}
while(num1>=num2) //prints number from low to high
{
cout<<num2;
num2++;
}
return 0;
}