Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Receive a set of integers (arrays) from the keyboard, output array elements, output the maximum and minimum values in the array, and arrange the arrays from small to large.
Receive a set of integers (arrays) from the keyboard, output array elements, output the maximum and minimum values in the array, and arrange the arrays from small to large.
Import java.util.scanner;

Public class ComPareNum {

Public static void main(String[] args) {

Scanner sc = new scanner (system. in);

System.out.println ("Please enter the number of digits you want to enter:");

int num = sc . nextint();

int arr[]= new int[num];

for(int I = 1; I<= numi++){

System.out.println ("Please enter the number" +i+ "you want to enter:");

arr[I- 1]= sc . nextint();

}

//sort

for(int I = 0; I < array length; i++){

for(int j = 0; J< array length; j++){

Internal temperature;

if(arr[I]& lt; arr[j]){

temp = arr[I];

arr[I]= arr[j];

arr[j]= temp;

}

}

}

System.out.println ("The minimum number you enter is:"+arr [0]);

System.out.println ("The maximum number you enter is"+arr [num-1]);

for(int I = 0; I < array length; i ++){

System.out.println ("The final sort of your array is"+(I+1)+"th:"+arr [I]);

}

}

}