C if else - if else Statement in C Program



 if else Statement in C Program

Learn c - c tutorial - if else Statement in C Program - c examples - c programs

if else Statement in C Program

  • An if statement can be followed by an optional else statement, which executes when the Boolean expression is false.
  • If the Boolean expression evaluates to true, then the if block will be executed, otherwise, the else block will be executed.
  • C programming language assumes any non-zero and non-null values as true, and if it is either zero or null, then it is assumed as false value.

Sample Code

#include <stdio.h>
int main()
{
    int a=10;
    if(a==10)
        printf("First condition is true\n");
    else
        printf("First condition is false\n");
}

Output

First condition is true


View More Quick Examples


Related Searches to C if else - if else Statement in C Program