icabit

assignment

Jun 28th, 2011
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.*;
  2. public class ass
  3. {
  4.                 static BufferedReader in = new BufferedReader (new InputStreamReader(System.in));
  5.         public static void main(String args []) throws IOException
  6.         {
  7.                         System.out.print("enter size of array: ");
  8.                         int x= 0;
  9.                         x=Integer.parseInt(in.readLine());
  10.                         int [] p= new int [x];
  11.                         int z=0;
  12.                         int t=0;
  13.                           for(int y=0;y<x;y++)
  14.                         {
  15.                                 System.out.print("enter element for array#"+(y+1)+": ");
  16.                                 p[y]=Integer.parseInt(in.readLine());
  17.                         }
  18.                           for(int r=0;r<x;r++)
  19.                           {
  20.                             z=0;
  21.                             for(int e=1;e<x;e++)
  22.                                 {
  23.                                     if (p[r]>=p[e]){
  24.                                         z++;
  25.                                        System.out.println(z);
  26.                                     }
  27.                             }
  28.                                     if (z==x-1)
  29.                                     {
  30.                                         t=p[r];
  31.                                         r=x;                                       
  32.                                     }
  33.                                        System.out.println("skip");                         
  34.                           }
  35.                         System.out.print("highest number is: "+t);
  36.         }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment