#include<iostream.h>
int Lsearch(int [ ],int ,int );
int main( )
{
int AR[50],ITEM,N,INDEX;
cout<<”Enter the desired array size(max. 50)”<<endl;
cin>>N;
cout<<”Enter Array elements”<<endl;
for(int i=0;i<N;i++)
{
cin>>AR[i];
}
cout<<”Enter the element to be searched”<<endl;
cin>>ITEM;
index=Lsearch(AR,N,ITEM);
if(index==-1)
cout<<”Sorry!! Given element could not be found”<<endl;
else
cout<<”Element found at index:”<<index<<”,Position:”<<index+1<<endl;
return 0;
}
int Lsearch(int AR[ ],int size,int item)
{
for(int i=0;i<size;i++)
{
if(AR[i]==item)
return i;
}
return -1;
}