Thursday 17 October 2013

CPP Program to Check whether a number is even or odd

//Write a program to check whether a number is even or odd.
#include<iostream.h>
#include<conio.h>
void main()

{
clrscr();
int n;
cout<<"Check a Number Even or Odd";

cout<<"\n\nEnter a number-";
cin>>n;

if(n%2==0)
cout<<"Enter number is even";
else
cout<<"Enter number is odd";
cout<<"\n\nPress Key For exit.....";
getch();
}

Output:

No comments:

Comments System