Linear Search in C Program & Flowchart - Sequential Search

In this tutorial, we will learn briefly about linear search then understand flow chart, Program for linear search in C.

It is a basic search technique to find an element from the collection of elements(in sequence) or from an array that why it is also known as Sequential Search. Now I think you have a doubt "Why Linear search basic?" because it is not fast or quick to find the element like other techniques or we can say it is the first searching algorithm touch by anyone who wants to learn searching techniques. 

In this technique, we take one element from the user which we have to find from the sequence of elements and if our program finds then message come out element found at this place else element not found. 

Below I shared Linear Search, Flow Chart and also Source code in C with output. So, All understand it quickly and with the whole knowledge.

linear search flowchart example

Here we discuss the linear search flowchart in which we start from the starting point check elements are present or it has zero element if it contains zero element then direct we can say that element not found else search element if found then print Element found at this position else increase the position by one and if all location have different then from the last position we can say element is not found. Below flowchart explain it in a clear way because vision clear all doubt easily.

linear search flowchart example
Linear Search Flow Chart

Linear Search in C


int main()
int i,flag=0,pos,n,a[5];
printf("Enter elements in array \t");
printf("\nEnter element number \t",i+1);
printf("\nEntered 5 arrray elements are:-");
printf("\nEnter the element to be searched in array");
printf("\nSearch Successful");
printf("\nElement %d is found at %d position",n,i+1);
printf("\nElement does not found");
return 0;


Enter elements in array
Enter element number    5

Enter element number    4

Enter element number    8

Enter element number    2

Enter element number    0

Entered 5 arrray elements are:-





Enter the element to be searched in array0

Search Successful
Element 0 is found at 5 position

In the Above article, We discuss linear search - linear search in c and linear search flowchart and if you have any doubt in the article then comment below.

Happy Coding 😊

No comments:

If you have any doubts, Please let me know

Powered by Blogger.