public class demo8_2 {
public static void main(String[] args) {
int[]s=new int[30];
for(int i=1;i<s.length+1;i++){
s[i-1]=i*2;}
for(int a:s)
System.out.print(a+" ");
}
int[]s1=new int[6];
int sum=0;
int b=0;
for(int i=0;i<s.length;i++){
if(i%5==0&&i!=0){
s1[b]=sum/5;
b++;
sum=0; }
sum=sum+s[i];
}
s1[b]=sum/5;
for(int c:s1)
System.out.print(c+" ");
}
}
}
Caballarii
相关分类