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.
// remove the other remain heade file these are the only one which needed
include
include
using namespace std;
int main() {
//taking input
int a, b;
cin >> a >> b;
// creating a array of lowercase letter
string numString[] = {"one","two", "three", "four", "five", "six", "seven", "eight", "nine"};
// creating a for loop and initialize it with a & b
for(int i = a; i <= b; i++) {
// checking if it's greater than 1 & smaller than 9
if(i >= 1 && i <= 9) {
// if yes printing the letter
cout << numString[i - 1] << endl;
} else {
// if, > 9 then checking it's odd or even
cout << (i % 2 == 0 ? "even" : "odd") << endl;
}
}
return 0;
}
`
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
For Loop
You are viewing a single comment's thread. Return to all comments →
// remove the other remain heade file these are the only one which needed
include
include
using namespace std;
int main() {
} `