class Sequentialsearch
{
void search(int a[],int x)
{
for(int i=0;i<11;i++)
{
if(a[i]==x)
System.out.println("a["+i+"] = "+a[i]);
else
System.out.println("Not found");
}
}
}
class Sequentialsearchmain
{
public static void main(String args[])
{
Sequentialsearch s=new Sequentialsearch();
int arr[]={4,1,5,7,9,3,4,6,8,5,2};
s.search(arr,6);
}
}
0 comments:
Post a Comment