java 输入n个整数并获取最大数与最小数

基础题目
代码如下:

public class main {

	public static void main(String[] args) {
		int index = 10;
		int min = 0,max = 0;
		Scanner sc = new Scanner(System.in); 
	    int num = sc.nextInt();
	    if(num>10) {
	    	index = num;
	    }
	    int a[] = new int [index];
	    Scanner sc2 = new Scanner(System.in);
	    for(int i=0;imax){
	    		max = a[i];
	    	}else if(a[i]

你可能感兴趣的:(基础编程题)