import java.util.Scanner;
public class MaxMin {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
System.out.println("输入数组的长度:");
int count=scan.nextInt();
System.out.println("输出数组的"+count+"个数:");
int[] arr=new int[count];
for(int i=0;i<arr.length;i++){
arr[i]=scan.nextInt();
}
System.out.println("输出数组:");
for(int i=0;i<arr.length;i++){
System.out.print(arr[i]+"\t");
}
int max=Integer.MIN_VALUE;
int min=Integer.MAX_VALUE;
for(int i=0;i<arr.length;i++){
if(arr[i]>max){ //求出最大值
max=arr[i];
}
if(arr[i]<min){ //求出最小值
min=arr[i];
}
}
System.out.println("\n最大值:"+max);
System.out.println("最小值:"+min);
}
}