We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- Introduction
- For Loop
- Discussions
For Loop
For Loop
Sort by
recency
|
1576 Discussions
|
Please Login in order to post a comment
The question i have on this problem is it is not tell me in the question how far the size is or if the number going to be the number 100
include
include
using namespace std;
int main() { // Complete the code. int a,b; cin >> a >> b ; for(int i = a; i <= b; i++) { int n = i; if (n == 1) { std::cout << "one" << endl; } else if (n == 2) { std::cout << "two" << endl; } else if (n == 3) { std::cout << "three" << endl; } else if (n == 4) { std::cout << "four" << endl; } else if (n == 5) { std::cout << "five" << endl; } else if (n == 6) { std::cout << "six" << endl; } else if (n == 7) { std::cout << "seven" << endl; } else if (n == 8) { std::cout << "eight" << endl; } else if (n == 9) { std::cout << "nine" << endl; } else { if(n%2==0){ cout <<"even" << endl; } else{ cout << "odd" << endl; } }
} return 0; }
int main() {
}