//program to search an element in 1 d array
//here p=position
#include<iostream>
using namespace std;
int main()
{
int a[10],size,i,f,num,p;
cout<<"\n Enter the element in the array:";
cin>>size;
cout<<"\n enter the element in assending array";
for(i=0;i<size;i++)
cin>>a[i];
cout<<"\n enetr the element for search";
cin>>num;
for(i=0;i<size;i++)
if(a[i]==num)
{
f=1;
p=i;
break;
}
if(f==0)
cout<<"\n no any element";
else
cout<<"\n element position is"<<p;
}
//here p=position
#include<iostream>
using namespace std;
int main()
{
int a[10],size,i,f,num,p;
cout<<"\n Enter the element in the array:";
cin>>size;
cout<<"\n enter the element in assending array";
for(i=0;i<size;i++)
cin>>a[i];
cout<<"\n enetr the element for search";
cin>>num;
for(i=0;i<size;i++)
if(a[i]==num)
{
f=1;
p=i;
break;
}
if(f==0)
cout<<"\n no any element";
else
cout<<"\n element position is"<<p;
}