I have two problems to work. This one uses n = 9 and the other one uses n = 10. ++i means to increment i from 1 to 2 before determining if the integer is odd or even but when I run the program with both numbers, I get a blank answer.
Suggestions please!
Code:#include <iostream>
using namespace std;
#include <conio.h>
int main()
{
int n = 9;
int i = 1;
while (i < n) {
if ((i % 2) == 0) {
++i;
}
}
cout << i << endl;
getch();
return 0;
}