C Introduction
Control Statement
Functions
Array
Pointers
Structure and Union
Data Files
An effective way to use of Else If
In this program, We will learn to use of else if condition in effective way. For this we will take an example to check number is less thank 50 or not. To understand this example, You must have knowledge in following topics
In this example, We will take integer input from user and store in variable and check whether number is less than 50 or not.
Algorithm
This is the algorithm to check whether number is less than 50 or not
Step 1: Start
Step 2: Initialize integer variable as the number
Step 3: Read integer variable and store in number
Step 4: IF number < 50
Step 4.1 : Number is less than 50
Step 5: Else
step 5.1: Number is greater than 50
Step 2: End
Flowchart
This is the flowchart to check whether number is less than 50 or not

Now, Let’s look an code to understand how to check whether number is less than 50 or not with the use of else if
CODE: Use of Else if
#include<stdio.h>
int main()
{
int number;
printf("Please enter a number: ");
scanf("%d",&number);
//For single statements we can skip the curly brackets
if(number < 50)
printf("\nNumber is less than 50!\n");
else
printf("\nNumber is greater than 50!\n");
return 0;
}
The output of above program is
Please enter a number: 12
Number is less than 50!
Please enter a number: 57
Number is greater than 50!