If-Else Statement :

if(conditional)
{  
//True code
}
else
{
//False code
}

Note :

Consider Following Example -

int num = 20;
if(num == 20)
    {  
    printf("True Block");
    }
else
    {
    printf("False Block");
    }
  1. If part Executed if Condition Statement is True.
  2. if(num == 20)
        {  
        printf("True Block");
        }
    

    True Block will be executed if condition is True.

  3. Else Part executed if Condition Statement is False.
  4. else
        {
        printf("False Block");
        }
    
  5. More than One Conditions can be Written inside If statement.
  6. int num1 = 20; 
    int num2 = 40;
    if(num1 == 20 && num2 == 40)
        {  
        printf("True Block");
        }
    
  7. Opening and Closing Braces are required only when “Code” after if statement occupies multiple lines.
  8. Code will be executed if condition statement is True.
  9. Non-Zero Number Inside if means “TRUE Condition”

Program Flow of If-Else Statement :