This is an assignment that I'm having trouble with, these are the 2 questions I'm having trouble with.
2. Write a loop that counts only the odd numbers out of the first five numbers entered from the keyboard, but does not count (skips) the number 7. Use the keyword continue to skip 7 inside the loop
3. Write the same program above, but exit the loop using break if the number 7 is entered
So my program works just fine but I'm not sure how to implement the two 7 parts?? Any help would be appreciated.
#include <iostream>
using namespace std;
int main(){
int nNums = 5;
int count=0,i;
int number;
for (i=0;i<nNums;i++){
cout << "Please Enter a Number: ";
cin >> number;
if (number%2 != 0) count++;
}
cout << "Number of odd numbers: " << count << endl;
return 0;