Nested if statements in C++

by Nideesh C on May 7, 2011 · 0 comments

in C++




Often it becomes a necessity to specify conditions within conditions, in order to execute a set of statements. In such situations, we can make use of the nested if constructs. These constructs are specified one inside the other.

Nested if statementsSyntax:

if (condition)

{

Statements;

.

.

if (condition)

{

Statements;

.

.

}

.

.

}

/*—————————————————————–

#include<iostream.h>

#include<conio.h>

void main()

{

int a= 10,b=20,c=30;

if (a>b)

if (a<c)

cout<<” a is small “;

getch();

}

/*———————————————————–*/

Output:

a is small

See also: Nested If…Else Statements in C++

 

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. if……else statements in C++
  2. Simple IF statement in C++
  3. if statement in C++
  4. Java program – Nested loops
  5. How to add widgets to wordpress footer ? Step by step simple tutorial

Leave a Comment

Previous post:

Next post: