Write a program to search an element of choice from the array having ‘n’ number of element, using Linear Search.

#include
#include
main()
{
int a[100],i,n,search;
cout<>n;
cout<<"n enter elements :";
for(i=0;i>a[i];
}
cout<>seacrh;
for(i=0;i<n;i++)
{
if(a[i]==search)
{
cout<<"n found at location :"<<i+1;
}
else
{
cout<<"n not found :";
}
getch();
}

Leave a reply