Write a java program that would input 15 numbers and then output the highest number and the lowest number as well. The program will also display the original inputted numbers.​

Sagot :

Answer:

import java.util.Scanner;

public class App {

   public static void main(String[] args)  {

       Scanner scanner = new Scanner(System.in);

       int high = 0;

       int low = 0;

       for (int i = 0; i < 15; i++) {

           System.out.print("Enter a number: ");

           int num = scanner.nextInt();

           if (i == 0) {

               high = num;

               low = num;

           }

           if (num > high) {

               high = num;

           }

           if (num < low) {

               low = num;

           }

       }

       System.out.println("Highest number is: " + high);

       System.out.println("Lowest number is: " + low);

   }

}

Explanation:

Output Console

View image AnthonyD