Tuesday, 14 February 2017

program to check odd or even number in TurboC++

Tags

After doing this program you assure that, how to use if and else condition in programs.

//program to check even or odd no:



#include<iostream.h>
#include<conio.h>

void main()
{

int no;
clrscr();

cout<<"enter no:-";
cin>>no;

//checking if no is divisible by two or not.
if(no%2==0)

{

cout<<"\n even no";

}
else
{
cout<<"\n odd no";
}

getch();
}