//this is a program Of searching of the array element
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int a[5],i,search;
//Accepting the array elements
cout<<"\n\n\tEnter the elements of the array: ";
for(i=0;i<5;i++)
{
cout<<"\n\tEnter the element: ";
cin>>a[i];
}
//Displaying the array elements
cout<<"\n\n\tDisplaying the array elements: \n\t";
for(i=0;i<5;i++)
cout<<" "<<a[i];
//Accepting the array element to be found
cout<<"\n\n\tEnter the element you want to find: ";
cin>>search;
//Searching the element
for(i=0;i<5;i++)
{
if(a[i]==search)
{
cout<<"\n\n\tElement found.";
break;
}
}
if(i==5)
cout<<"\n\n\tElement not found.";
return 0;
}
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int a[5],i,search;
//Accepting the array elements
cout<<"\n\n\tEnter the elements of the array: ";
for(i=0;i<5;i++)
{
cout<<"\n\tEnter the element: ";
cin>>a[i];
}
//Displaying the array elements
cout<<"\n\n\tDisplaying the array elements: \n\t";
for(i=0;i<5;i++)
cout<<" "<<a[i];
//Accepting the array element to be found
cout<<"\n\n\tEnter the element you want to find: ";
cin>>search;
//Searching the element
for(i=0;i<5;i++)
{
if(a[i]==search)
{
cout<<"\n\n\tElement found.";
break;
}
}
if(i==5)
cout<<"\n\n\tElement not found.";
return 0;
}