package cn.hp;
public class Demo01 {
public static void main(String[] args) {
int[] arr = {1,3,5,-2,4,6};
int max = arr[0] ;
int min = arr[0] ;
int sum = 0;
double avg = 0 ;
for (int i=0; i<arr.length; i++){
if(arr[i] >max){
max = arr[i];
}
if(arr[i] < min){
min = arr[i];
}
sum+=arr[i];
avg = 1.0*sum/arr.length;
}
System.out.println("max = " + max);
System.out.println("min = " + min);
System.out.println("sum = " + sum);
System.out.println("avg = " + avg);
}
}