#include<stdio.h>
#include<conio.h>
void input(int arr[],int);
void display(int arr[],int);
void linearsearch(int arr[],int n,int item);
void main()
{
int arr[10],n,size,item;
clrscr();
printf("Enter size of array=");
scanf("%d",&n);
input(arr,n);
display(arr,n);
printf("\nEnter the element to be searched");
scanf("%d",&item);
linearsearch(arr,n,item);
getch();
}
void input(int arr[],int n)
{
int i;
for(i=0;i<n;i++)
{
printf("\nEnter element=");
scanf("%d",&arr[i]);
}
}
void display(int arr[],int n)
{
int i;
printf("\nThe array is=");
for(i=0;i<n;i++)
{
printf("\n%d",arr[i]);
}
}
void linearsearch(int arr[],int n,int item)
{
int i,f=0;
for(i=0;i<n;i++)
{
if(arr[i]==item)
{
f=1;
printf("\nElement found at location=%d",i);
break;
}
}
if(f==0)
{
printf("\nElement not found");
}
}



WE ALSO PROVIDE THE ON DEMAND PROJECTS EITHER THEY ARE DOMESTIC, COLLEGE PROJECTS, OR COMMERCIAL PROJECTS. YOU WILL GET THE PROJECT COMPLETELY ACCORDING TO YOUR REQUIREMENTS.
CONTACT US AT :- knowledgeforyou2022@gmail.com

Leave a Reply

Your email address will not be published.