Tuesday, 24 February 2015

Nested If Condition in C++

#include<iostream.h>
#include<conio.h>
main()
{
int a;
clrscr();
cout<<"\n Enter Number ( 1 - 2 - 3 ) :";
cin>>a;

if(a>0&&a<4)
{
if(a==1)
{
cout<<"\n Given Number is One";
}
else if(a==2)
{
cout<<"\n Given Number is Two";
}
else
{
cout<<"\n Given Number is Three";
}
}
else
{
cout<<"\n Wrong Number";
}
getch();
}

No comments:

Post a Comment