Respuesta :

Answer:

Explanation:

The following code is written in Java and asks the user to input a sequence of numbers separated by pressing the "ENTER" key and typing 000 to terminate the sequence. It saves all those numbers in an ArrayList and then goes through the Array to find and print the max number.

public static void MaxNumber () {

           Scanner in = new Scanner(System.in);

           System.out.println("Enter a as many numbers as you want seperated by the Enter Key... type 000 when done. ");

           ArrayList<Integer> numbers = new ArrayList<>();

           int exit = 1;

           while (exit != 000) {

               exit = in.nextInt();

               numbers.add(exit);

           }

           int max = 0;

           for (int x = 0; x < numbers.size(); x++) {

               if (numbers.get(x) > max) {

                   max = numbers.get(x);

               }

           }

           System.out.println(max);

       }

ACCESS MORE
EDU ACCESS