帮忙看看这两个题的最佳答案
追答public class Test {
public static void main(String[] args) {
int[] a = new int[30];
int num = 0;
int count=0;
int sum=0;
int j=0;
int[] b = new int [6];
for (int i = 0; i < a.length; i++) {
num += 2;
a[i] = num;
sum+=a[i];
count++;
if(count%5==0) {
b[j++]=sum/5;
sum=0;
}
}
for (int aa : b) {
System.out.print(aa+" ");
}
}
}
//6 16 26 36 46 56
嗯嗯
我明天试试
认识认识吧?
为什么出来的答案是2 4 6 8 10 12