Searching


import java.io.*;
class so
{
public static void main(String a[])
{
int i,j,k,n;
try
{
int s[]=new int[20];
InputStreamReader ii;
BufferedReader br;

ii=new InputStreamReader(System.in);
br=new BufferedReader(ii);
System.out.println("Enter the n value");
n=Integer.parseInt(br.readLine());
System.out.println("Enter the n number");
for(i=1;i < =n;i++) s[i]=Integer.parseInt(br.readLine()); for(i=1;i < =n;i++) for(j=1;j < =n;j++) if(s[i] < t="s[i];" k="Integer.parseInt(br.readLine());" i="1;i">javac so.java

c:\java>
c:\java>java so
Enter teh n value
5
Enter the n number
5
4
3
2
12
Enter search key
5
The value is found