Dec 29, 2011

Using Nested Condition

Using Nested Condition

Nested Condition is if else condition that is used under if or else condition. Its condition within condition. Like : We have to check Something Like Someone DOB First i check date then Month and Then Year Three Statement check in One Condition.
Check out One Example For Better Understand.




#include<iostream.h>

#include<conio.h>

int main()

{
int number;

cout << "Enter Any Number\n";
cin >> number;

if(number >10) // check number greater than 10
{
if(number <100)    // check number less than 100
{
    cout << "Number is Between 10-100";
}
}

else
{
if(number<10) // check number less than 10
{
cout << "Number is less than 10";
}
}

getch();

return 0;


}


OUTPUT




0 comments:

Post a Comment