hey can anyone help this is the code i have. i need to ouput the even and odd integers between two integers. i think what i have might work but when i run it it keeps running and never stops. also first num needs to be less then second anyone please help me
{
int firstNum, secondNum;
int firstNum_1, secondNum_1;
int sumOdd, sumEven;
sumOdd = 0;
sumEven = 0;
bool num0 = false;
while (!num0)
{
cout << "Please enter in a number: ";
cin >> firstNum;
cout << "Plese enter a second number: ";
cin >> secondNum;
if (firstNum <= secondNum)
{
num0 = true;
}
else if (firstNum > secondNum)
{
cout << "First number should be less than Second number" << endl;
}
}
firstNum_1 = firstNum;
secondNum_1 = secondNum;
while(firstNum != secondNum)
{
cout << "\n" << "Odd Numbers in between" << ' ' << firstNum << ' ' << "and" << ' ' << secondNum << ' ' << "is :" << ' ';
if((firstNum % 2) != 0)
{
cout << firstNum;
sumOdd += firstNum;
}
if(((firstNum % 2) != 0) && (firstNum != secondNum))
{
cout << ",";
}
while(firstNum_1 != secondNum_1)
{
cout << "\n" << "\n" << "Even Numbers in between" << ' ' << firstNum_1 << ' ' << "and" << ' ' << secondNum_1 << ' ' << "is :" << ' ';
if((firstNum_1 % 2) == 0)
{
cout << firstNum_1;
sumEven += firstNum_1;
}
if(((firstNum_1 % 2) == 0) && (firstNum_1 != secondNum_1))
{
cout << ",";
}
}
}