` C - nested if statement- Decodejava.com


Advertisement



< Prev
Next >



C - Nested If Statement





In nested-if decision making statement of C language, an if statement is nested inside an outer if statement, hence it is named nested if.

The statement connected to the nested if statement is only executed when -: Note: There could be an optional else statement associated with the outer if statement, which is only executed when the condition of the outer if statement is evaluated to be false and in this case, the condition of nested if condition won't be checked at all.




Advertisement




nested if example


/* nested if statement*/

#include<stdio.h>
int main()
{
if(99<100)
{
	if(99<101)  /* This is a nested if  statement*/
	printf("99 is less than 100 & 99 is also less than 101");
}

else 
	printf("99 is not less than 100");
	
return 0;
}


Output


99 is less than 100 & 99 is also less than 101




Please share this article -





< Prev
Next >
< Else-If Statement
Nested If-Else Statement>



Advertisement

Please Subscribe

Please subscribe to our social media channels for daily updates.


Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page




Advertisement

Notifications



Please check our latest addition

PYTHON and DJANGO


Advertisement