inp1 = getinp1();
inp2 = getinp2();
inp3 = getinp3();
inp4 = getinp4();
inp5 = getinp5();
int[] numbers = {inp1,inp2,inp3,inp4,inp5};
Arrays.sort(numbers);
System.out.println("The highest number is "+numbers[2]);
System.out.println("The middle number is "+numbers[1]);
System.out.println("The lowest number is "+numbers[0]);
The output are showing only inp3, inp4 , inp5 but it must need to mix with other inputs so that it could make a right decision what is highest middle and smallest value
As per the above Code the index which you have mentioned is wrong. It should be like below.
System.out.println("The highest number is "+numbers[numbers.length-1]);
System.out.println("The middle number is "+numbers[2]);
System.out.println("The lowest number is "+numbers[0]);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.