-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA-You.cpp
More file actions
36 lines (31 loc) · 723 Bytes
/
A-You.cpp
File metadata and controls
36 lines (31 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
using namespace std;
string intToWord(int num) {
switch(num) {
case 1: return "one";
case 2: return "two";
case 3: return "three";
case 4: return "four";
case 5: return "five";
case 6: return "six";
case 7: return "seven";
case 8: return "eight";
case 9: return "nine";
default: return "";
}
}
string evenOdd(int num) {
return (num % 2 == 0) ? "even" : "odd";
}
int main() {
int a, b;
cin >> a >> b;
for (int i = a; i <= b; ++i) {
if (i >= 1 && i <= 9) {
cout << intToWord(i) << endl;
} else {
cout << evenOdd(i) << endl;
}
}
return 0;
}