Explore a little.C ProgrammingC++HTMLVisual BasicSystem AnalysisE-CommerceBCA Notes
LEARN SOMETHING NEW

C++ Program to check whether the number is even or odd

Read4BCA learning libraryFree access

C++ Program to check whether the number is even or odd

//C++ Program to check whether the number is even or odd
//header files
#include<iostream.h>
#include<conio.h>

void main()
{

clrscr();
int n;
cout<<"Enter an integer:";
cin>>n;
if(n%2==0)
{

cout<<n<<" is even";

}
else
{

cout<<n<<" is odd";

}

getch();

}
//Now run the program by ctrl+f9

Output

C++ Program to check whether the number is even or odd example

You can also see a video how to run this program

This lesson preserves the original Read4BCA material. Some programming examples use older tools and syntax. View original page.