Hello, Please help me with my code.
I want the user to input 2 numbers.
Then the program will extract the even numbers between these two numbers.
And extract the odd numbers as well.
For Example:-
if the user put 1 and 4
Even numbers: 2 4
Odd numbers: 1 3
#include <iostream>
usingnamespace std;
int main()
{
int num1;
int num2;
int n;
n = 0;
cout << "Please enter 2 numbers and I will tell you the range between them.\n";
cout << "Enter the first number \n";
cin >> num1;
cout << "Enter the second number \n";
cin >> num2;
while (num1<=n && num2>=n)
{
if ((n % 2) == 0)
cout << "The even numbers are " << n;
if ((n % 2) != 0)
cout << "The odd numbers are " << n;
n++;
}
return 0;
}