LINEAR/SEQUENTIAL SEARCH

If you have any queries please leave a message here
Your Message
×


In computer science, linear search or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched.


Linear Search Programming

#include<stdio.h>

//Global array declaration
int array[]={10, 20, 30, 40, 50, 60, 70, 80, 90, 100};
//Global function declaration
int LinearSearch(int list[],int value);

void main()
{
int number, retn;
printf("\n Enter the number you want to search...");
scanf("%d",&number);
retn=LinearSearch(array,number);
if(retn == 0)
printf("\n Number not found");
else
printf("\n Number found");
}

int LinearSearch(int list[],int value)
{
int i,len,count=0;
len=(sizeof(array)/sizeof(int));
for(i=0;i<len;i++)
{
if(list[i] == value)
count++;
}
return count;
}


ABOUT US

QuestionSolves.com is an educational website that helps worldwide students in solving computer education related queries.

Also, different software like Visual Studio, SQL Server, Oracle etc. are available to download in different versions.

Moreover, QuestionSolves.com provides solutions to your questions and assignments also.


MORE TOPIC


Windows Command

UNIX Command

IGNOU Assignment Solution

IGNOU Question Paper Solution

Solutions of Different Questions


WHAT WE DO


Website Devlopment

Training

Home Learning

Provide BCA, MCA Projects

Provide Assignment & Question Paper Solution


CONTACT US


Follow Us