-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfor-loop.cpp
More file actions
38 lines (36 loc) · 911 Bytes
/
Copy pathfor-loop.cpp
File metadata and controls
38 lines (36 loc) · 911 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
37
38
// Hackerrank
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
// Complete the code.
int a, b;
scanf("%d %d", &a, &b);
for (int i = a; i <= b; i++){
int value = i;
if(value > 9 && value % 2 == 0)
printf("even");
else if (value > 9 && value % 2 == 1)
printf("odd");
else if( value == 9)
printf("nine");
else if (value == 8)
printf("eight");
else if (value == 7)
printf("seven");
else if (value == 6)
printf("six");
else if (value == 5)
printf("five");
else if (value == 4)
printf("four");
else if (value == 3)
printf("three");
else if (value == 2)
printf("two");
else if (value == 1)
printf("one");
printf("\n");
}
return 0;
}