In C, Conditional Statement: IF, IF Else and nested Block
The 'if' statement will run the block of code , the Boolean expression evaluates to true or false.
Syntax:
if(condition or expression) {
/* block of code */
}
Example :
#include <stdio.h>
int main () {
int a = 15;
if( a < 20 ) {
if(a<10)
printf("a is less than 10\n" );
else if (a=10)
printf("a is equal to 10\n" );
else
printf("a is greater than 10\n" );
}
printf("value of a is : %d\n", a);
return 0;
}
Conclusion
Here we see a exapmle of If Else in C language .
If...else and if...else nested is usefull Keyword .
As C is a case sensitive language, If Else is keyword must written in lowercase.
It's occasionally , an if statement inside another if statement. Nested if statements are those that have an if statement inside of another if statement.