你要的效果是不是
123456
12345
1234
123
12
1
part of the code:
for(int i=0;i<6;i++) {
for(int k=0;k<i;k++) {
System.out.print(" ");
}
for(int k=0;k<6-i;k++) {
System.out.print(k+1);
}
System.out.println();
}
12345
1234
123
12
1
part of the code:
for(int i=0;i<6;i++) {
for(int k=0;k<i;k++) {
System.out.print(" ");
}
for(int k=0;k<6-i;k++) {
System.out.print(k+1);
}
System.out.println();
}