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
|
1656 Discussions
|
Please Login in order to post a comment
include
using namespace std;
int main() { string words[] = {"one","two","three","four","five","six","seven","eight","nine"}; int a, b; cin >> a >> b; for(int i = a; i <= b; i++) { if(i >= 1 && i <= 9) cout << words[i-1] << endl; else if(i % 2 == 0) cout << "even" << endl; else cout << "odd" << endl; } return 0; }
NEED CODE? HERE int a; int b;