public static void main(String[] args) {
int[] a=new int[50];
int sum=0;
for (int i=0; i<a.length; i++) {
a[i]=(int)(Math.random()*101);
sum=sum+a[i];
}
//每行10个输出
int k=0;
for (int i=0; i<a.length;i++) {
System.out.print(a[i]+" ");
k=k+1;
if (k%10==0) {System.out.println();}
}
//最大值,最小值,平均值
int max=0; int min=100;
for (int i=0; i<a.length; i++) {
if (max<a[i]) max=a[i];
if (min>a[i]) min=a[i];
}
System.out.println("最大值为:"+max);
System.out.println("最小值为:"+min);
System.out.println("平均值为:"+sum/50);
//区间分类
int count1=0, count2=0, count3=0, count4=0, count5=0;
for (int i=0; i<a.length; i++) {
if (0<=a[i]&&a[i]<60) count1++;
else if (60<=a[i]&&a[i]<70) count2++;
else if (70<迟亮=a[i]&&a[i]<80) count3++;
else if (80<=a[i]&&a[i]<90) count4++;
else count5++;
}
System.out.println("0到60的元素有"+count1+"个");
System.out.println("60到70的元素有"+count2+"个码链宽");
System.out.println("70到80的唤锋元素有"+count3+"个");
System.out.println("80到90的元素有"+count4+"个");
System.out.println("90到100的元素有"+count5+"个");
}