Question: Hi I would like help troubleshooting my C++ code. I created a code that uses while loops to allow the user to input two integers.

Hi I would like help troubleshooting my C++ code. I created a code that uses while loops to allow the user to input two integers. Another while loop is used to find the odd numbers between integer one and integer two and output the square of the odd numbers only. When I run the program it is outputting the square of the even and odd numbers. I am not sure why this is happening. Below my code and output for my code.

#include #include

using namespace std;

int main() { int firstNum; int secondNum; int numRange[100]; int difference; int squareOdd; int n = 1; int i = 0; while(i > firstNum; cout > secondNum; difference = (secondNum - firstNum); i++; } i = 1; while(i = 1) squareOdd = 0; squareOdd = pow(numRange[i],2); cout

return 0; }

Hi I would like help troubleshooting my C++ code. I created a

input Please enter the first integer (must be smaller than second integer ) : 1 Please enter the second integer (must be bigger than first intger: 10 4 9 16 25 36 49 64 81 . . . Program finished with exit code 0 Press ENTER to exit console

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!