Nested if in C language by R4R Team

Nested if :
-It refers as the if statement inside the if another if statement.

Syntax-
if(condition1)
{
if(condition2)
{
if(condition3)
{
....
}
}
}


program-

#include< stdio.h>
int main()
{
int a,b;
printf("Enter Two Number\n");
scanf("%d%d",&a,&b);
if(a==1)
{
if(b>0){
printf("Both Condition is True");
}
}
}


output-

Enter Two Number
1
8
Both Condition is True

Enter Two Number
1
-3

-In this program, we take a input of two integer number then try to check that first number is 1 and second number is positive number
-If both condition is true then it print the output otherwise it not execute if body.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!