If-Else Statement with simple program

In the last article, we have studied about the if statement, this article leads to the extension of the if statement that also can be used while solving any problem. So far we have read that if statement is used to check only one condition. If condition is true then following statement will be executed, but if condition is not true or simply false, then what will happen? As in practical there must be some way to execute the another statement (when condition is not met).

So to overcome this issue certain practices were made. One such practice leads to the developement of  If-Else statement. If-Else is also one of the most useful conditional statement used in C to check conditions. An if statement can be followed by an optional else statement, which executes when the boolean expression is false.





       true statements;




       false statements;


In above syntax, the condition is checked first. If it is true, then the program control flow goes inside the braces and executes the block of statements associated with it. If it returns false, then it executes the else part of a program.

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.

Program :

/*  Program to demonstrate if-else statement.

#include <stdio.h>

#include <conio.h>

void main()


       int num;


       printf(“\n Enter Number :”);



              printf(“\n\n Number is even”);


              printf(“\n\n Number is odd”);