Thursday, August 23, 2018

Odd and Even Number Checker Using Switch Statement in C++

A very simple program that I wrote to show how to use Switch statement in C++ to check if the given number is an odd or even number. I am using Dev C++ in writing this program. 

I am currently accepting programming work, it project, school 

programming projects , thesis and capstone projects, IT consulting 

work, computer tutorials and web development work kindly contact me in the following email address for further details.  If you want to advertise in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.com, jakerpomperada@aol.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

My personal website is http://www.jakerpomperada.com




Sample Program Output

Program Listing

// odd_even.cpp
// Author    : Mr. Jake R. Pomperada, BSCS,MAED-IT
// Date      : August 20, 2018   Monday
// Location  : Bacolod City, Negros Occidental Philippines.
// Website   : http://www.jakerpomperada.com
// Email     : jakerpomperada@jakerpomperada.com

#include <iostream>

using namespace std;


int main()
{
int num_input=0;
cout <<"\n";
cout << "\tOdd and Even Number Checker Using Switch Statement";
cout << "\n\n";
cout << "\tGive a Number : ";
cin >> num_input;
cout << "\n\n";
switch(num_input%2) 
    {
        case 0:
            cout <<"\tThe given number " <<num_input<< " is EVEN number.";
            break;
        case 1:
            cout <<"\tThe given number " <<num_input<< " is ODD number.";
            break;
    }
     
    cout <<"\n\n";
    cout << "\tEnd of Program";
    cout <<"\n\n";
}



No comments:

Post a Comment