public class Jinzita {
int i,j;
public Jinzita() {
}
void means(){
for(i=1; i<=5; i++){
for(j=0; j<5-i; j++){
System.out.print(" ");
}
System.out .print(i+" ");
for(j=2; j<=i; j++){
System.out .print(j+" ");
}
System.out.println();
}
}
public static void main(String[] args) {
Jinzita num = new Jinzita();
num.means();
}
}
兄弟 你试试上边的程序 应该没问题的
或者 下面的程序 其实一个样
public class Jinzita {
public Jinzita() {
}
public static void main(String[] args) {
int i,j;
for(i=1; i<=5; i++){
for(j=0; j<5-i; j++){
System.out.print(" ");
}
System.out .print(i+" ");
for(j=2; j<=i; j++){
System.out .print(j+" ");
}
System.out.println();
}
}
}