Code Below:
import java.util.*;
class linear
{
public static void main()
{
Scanner s=new Scanner(System.in);
int i,key,x=0;
System.out.println("ENTER KEY");
key=s.nextInt();
int arr[]=new int[10];
System.out.println("ENTER 10 NOS.");
for (i=0;i< 10;i++)
arr[i]=s.nextInt();
for (i=0;i< 10;i++)
if(arr[i]==key)
{
System.out.println("KEY IS FOUND AT INDEX NO. "+i);
x++;
}
if(x==0)
System.out.println("KEY NOT FOUND");
}
}