I'm trying to create a program that asks a user to enter 5 numbers and prints the highest number entered.
So far i have:
Any help will be greatly appreciated!import java.util.Scanner; import java.io.*; import java.io.IOException; import java.util.*; public class arrayNum { public static void main(String[] args)throws IOException{ Scanner input = new Scanner(System.in); int array[] = new int[5]; int count=0; int numbers; System.out.println("Please enter 5 numbers"); { while (count < 5) { numbers = input.nextInt(); count++; } } { int max = array[5]; for(int i = 0; i < array.length; i++) { if(array[i] > max) { max = array[i]; } } } System.out.println("Largest number is: " + max ); } }
Regards
Rob.