Thursday, 10 July 2014

C plusplus program to check whether a given integer is odd or even

Leave a Comment
/* C plus plus program to check whether a given integer is odd or even*/

#include<iostream>
#include<conio.h>
using namespace std;
    void main()
    {
    int number, remainder;
    cout<<"Enter an integer : ";
    cin>>ival;
    remainder = number % 2;

    if(remainder == 0)
        {
            cout<<number
                <<" is an even integer\n";
        }
    else
        {
            cout<<number
                <<" is an odd integer\n";
        }
    getch();
    }
If You Enjoyed This, Take 5 Seconds To Share It

0 Questions: