求最大数,最小数
package my;
public class MyJava {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] num = {10,5,13,22,87,44};
int max = num[0];
int min = num[0];
for (int i = 1; i < num.length; i++) {
if (num[i]>max) {
max = num[i];
}
if(num[i]<min){
min = num[i];
}
}
System.out.println(max);
System.out.println(min);
}
}