double duo_array[][] = {
{1*0},
{1*1,1*2},
{1*3,1*4,1*5},
{1*6,1*7,1*8},
{1*9,1*10},
{1*11}
} ;
int i, j = 0;
//unfinished business
for(i=0;i<6;i++) {
for(j=0;j<i+1;j++)
while(j!= 0 ) {
j--;
}
System.out.println(duo_array[i][j] + " ");
System.out.println();
}
}
答案 0 :(得分:0)
public static void main(String[] args) {double duo_array[][] = {
{1*0},
{1*1,1*2},
{1*3,1*4,1*5},
{1*6,1*7,1*8},
{1*9,1*10},
{1*11}
} ;
int i, j = 0;
//unfinished business
for(i=0;i<6;i++) {
for(j=0;j<duo_array[i].length;j++)
System.out.print(duo_array[i][j] + " ");
while(j!= 0 ) {
j--;
}
// System.out.println(duo_array[i][j] + " ");
System.out.println();
}
}
我改变了一个条件:j&lt; duo_array [I]。长度
和sysout的位置
答案 1 :(得分:0)
猜猜你想打印它如下 -
0.0
1.0 2.0
3.0 4.0 5.0
6.0 7.0 8.0
9.0 10.0
11.0
这是你未完成的事情 -
//unfinished business
for(int i=0;i<6;i++) {
if(i<3){
for(int j=0;j<i+1;j++)
System.out.print(duo_array[i][j] + " ");
}
else {
for(int j=0;j<duo_array.length-i;j++)
System.out.print(duo_array[i][j]+" ");
}
System.out.println();
}
希望有所帮助。