bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_2 / practice / prac_004.cpp

prac_004.cpp (524B)


      1 /* check even or odd */
      2 
      3 #include <iostream>
      4 using namespace std;
      5 class ooe {
      6     int n;
      7 
      8 public:
      9     void input();
     10     void calcdisp();
     11 };
     12 
     13 void ooe::input() {
     14     cout << "Enter the number : ";
     15     cin >> n;
     16 }
     17 
     18 void ooe::calcdisp() {
     19     if (n == 0) {
     20         cout << "0 neither a odd or a even number.";
     21     }
     22     else if (n % 2 == 0) {
     23         cout << n << " is a even number.";
     24     }
     25     else {
     26         cout << n << " is a odd number.";
     27     }
     28 }
     29 
     30 int main() {
     31     ooe a;
     32     a.input();
     33     a.calcdisp();
     34     return 0;
     35 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror