Start New Discussion within our Software Development Community
import java.io.*;
class compare
{
static void numbers()throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("How many numbers do you want to compare?\n");
        int n=Integer.parseInt(br.readLine());
        System.out.println("Enter "+n+" numbers to compare:\n");
        int y=Integer.parseInt(br.readLine()),a=y,b=y;
        for(int i=1;i<n;i++)
            {
                int x=Integer.parseInt(br.readLine());
                if(x<a)
                    {
                        a=x;
                    }
                else if(x>b)
                    {
                        b=x;
                    }
                }
        System.out.println("The highest numeber is: "+b+"\nLowest number is: "+a);
            }
        }
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.