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
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; }
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 consoleStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started