prac_004.cpp (660B)
1 /* 2 * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 22 Jun 2026 3 * Repo: https://github.com/notamitgamer/bsc 4 * License: MIT 5 */ 6 7 /* check even or odd */ 8 9 #include <iostream> 10 using namespace std; 11 class ooe { 12 int n; 13 14 public: 15 void input(); 16 void calcdisp(); 17 }; 18 19 void ooe::input() { 20 cout << "Enter the number : "; 21 cin >> n; 22 } 23 24 void ooe::calcdisp() { 25 if (n == 0) { 26 cout << "0 neither a odd or a even number."; 27 } 28 else if (n % 2 == 0) { 29 cout << n << " is a even number."; 30 } 31 else { 32 cout << n << " is a odd number."; 33 } 34 } 35 36 int main() { 37 ooe a; 38 a.input(); 39 a.calcdisp(); 40 return 0; 41 }