我想楼主应该是想要两个金字塔扣一块儿的吧,一下是代码,自己写的:
public class Test5 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
for (int i = 1; i <= 7; i++) {
for (int j = 1; j <= Math.abs(4 - i); j++) {
System.out.print(" ");
}
for (int k = 1; k <= 7-Math.abs(i-4)*2; k++) {
System.out.print("*");
}
System.out.println();
}
}
}
public static void main(String[] args) {
int xh=1;
for (int i = 0; i < 7; i++) {
if(xh<=7){
for(int j=0;j
}
System.out.print(" ");
}
if(i<3){
xh+=2;
}else{
xh-=2;
}
}
}