-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc-tutorial-for-loop.cpp
75 lines (62 loc) · 1.21 KB
/
c-tutorial-for-loop.cpp
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
* @file c-tutorial-for-loop.cpp
* @author Alexander Khvolis(ExpliuM)
* @link https://www.hackerrank.com/challenges/c-tutorial-for-loop/problem?isFullScreen=true
* @version 0.1
* @date 2023-02-17
*
* @copyright Copyright (c) 2023
*
*/
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int x, y;
cin >> x >> y;
for (int i = x; i <= y; i++)
{
switch (i)
{
case 1:
cout << "one";
break;
case 2:
cout << "two";
break;
case 3:
cout << "three";
break;
case 4:
cout << "four";
break;
case 5:
cout << "five";
break;
case 6:
cout << "six";
break;
case 7:
cout << "seven";
break;
case 8:
cout << "eight";
break;
case 9:
cout << "nine";
break;
default:
if (i % 2 == 0)
{
cout << "even";
}
else
{
cout << "odd";
}
}
cout << endl;
}
return 0;
}