prac_010.cpp ​
Metadata ​
- Author — Amit Dutta (amitdutta4255@gmail.com)
- Last updated — 22 Jun 2026
- License — MIT
Problem Statement ​
Problem Statement
check odd or even
Source Code ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
cpp
#include <iostream>
using namespace std;
class ooe {
int n;
public:
void input();
void calcdisp();
};
void ooe::input() {
cout << "Enter the number : ";
cin >> n;
}
void ooe::calcdisp() {
if (n == 0) {
cout << "0 is neither an odd nor an even number.";
}
else if (n % 2 == 0) {
cout << n << " is a even number.";
}
else {
cout << n << " is a odd number.";
}
}
int main() {
ooe a;
a.input();
a.calcdisp();
return 0;
}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
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