#include <iostream.h>
#include <conio.h>
#include <process.h>void main()
{
int arr[20], i;
for( i= 0; i< 20 ; i++)
{cout<< "\n Enter an element :";
cin >> arr[i];
}
int x;
cout<<" \n Enter an element to be searched for :";
cin>> x;
for(i = 0; i< n ; i++)
{
if(x == arr[i])
{
cout<<" \n The element is found in position : " << i+1;
getch();
exit(1);
}
}
cout<< "\n The element not found ";
getch();
}
No comments:
Post a Comment