Nested if-else

Nested if statement means that you can use one if or else statement inside another if or else statement.

The nested if statement looks like this:

if(condition) {
 if(condition) { 
execute this statement; 
}
 }

Example :

#include <stdio.h > 
int main() { 	
    int a=20,b=30; if (m>n) { 	
        printf(“a is greater than b”);
} else if(a < b) { 	printf(“a is less than b”);
} else { 	printf(“a is equal to b”);
} return 0;
}

Output :

   a is less than b

Report Error/ Suggestion

Related Posts:









CopyRight © 2020

CopyRight © 2020