Skip to content

Commit cb35aa6

Browse files
authored
Adding a tutorial for Dimik Even Odd 1 (#434)
* Create en.md * Update en.md
1 parent 109bdac commit cb35aa6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

dimik-even-odd-1/en.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Dimik - Even Odd 1
2+
3+
In this problem, you will be given `T` testcases.Each line of the testcase consist of an integer `n`.We have to determine whether `n` is even or odd.
4+
5+
### Solution
6+
* If n is divisible by 2
7+
* its a even number so print 'even'
8+
* if its not divisible by 2
9+
* its a odd number so print 'odd'
10+
11+
### C++
12+
```cpp
13+
#include <bits/stdc++.h>
14+
using namespace std;
15+
int main()
16+
{
17+
int t;
18+
cin >> t;
19+
for (int k = 1; k <= t; k++)
20+
{
21+
int n;
22+
cin >> n;
23+
if (n % 2)
24+
cout << "odd" << endl;
25+
else
26+
cout << "even" << endl;
27+
}
28+
}
29+
```

0 commit comments

Comments
 (0)