-
HackerRank.com Practice > C++ > Introduction > For Loophackerrank.com 2020. 4. 17. 07:03728x90
#include <iostream> #include <string> using namespace std; int main() { string ss[] = {"", "one", "two", "three", "four", "five",\ "six", "seven", "eight", "nine"}; string eo[] = {"even", "odd"}; int n, N; cin >> n >> N; for(int i=n; i<=N; ++i) { if(i < 10) { cout << ss[i] << '\n'; } else { cout << eo[(i % 2)] << '\n'; } } return 0; }
728x90'hackerrank.com' 카테고리의 다른 글
HackerRank.com Practice > C++ > Introduction > Pointer (0) 2020.04.17 HackerRank.com Practice > C++ > Introduction > Functions (0) 2020.04.17 HackerRank.com Practice > C++ > Introduction > Conditional Statements (0) 2020.04.16 HackerRank.com Practice > C++ > Introduction > Basic Data Types (0) 2020.04.16 HackerRank.com Practice > C++Introduction > Input and Output (0) 2020.04.16