#include
#include
void main()
{
clrscr();
int a[],n,x,i,flag=0;
cout<<"How many Elements?";
cin>>n;
cout<<"\nEnter Elements of the Array\n";
for(i=0;i cin>>a[i];
cout<<"\nEnter Element to search:";
cin>>x;
for(i=0;i {
if(a[i]==x)
{
flag++;
break;
}
}
if(flag==1)
cout<<"\nElement is Found at position "< else
cout<<"\nElement not found";
getch();
}
#include
void main()
{
clrscr();
int a[],n,x,i,flag=0;
cout<<"How many Elements?";
cin>>n;
cout<<"\nEnter Elements of the Array\n";
for(i=0;i
cout<<"\nEnter Element to search:";
cin>>x;
for(i=0;i
if(a[i]==x)
{
flag++;
break;
}
}
if(flag==1)
cout<<"\nElement is Found at position "< else
cout<<"\nElement not found";
getch();
}
No comments:
Post a Comment