class SanJiao {
public static void main(String[] args)
{
/* for (int i = 1; i <= 5; i++){
for (int j = i; j <=5; j++){
System.out.print(" ");
}
for (int k = 1; k <= i; k++){
if (k>=2&k<=i-1){
System.out.print(" ");
}System.out.print("*");
}
System.out.println();
}
for (int i = 1; i <= 5; i++){
for (int j =5-i; j <=5; j++){
System.out.print(" ");
}
for (int k = 1; k <=5-i; k++){
System.out.print(" *");
break;
}
System.out.println();
}*/
for (int i=1;i<=10 ;i++ ) {
for (int j=1;j<=10-i ; j++) {
System.out.print(" ");
}
if(i!=10) {
for (int z = 1;z<=(i-1)*2+1 ;z++ ) {
if (z==1||z==((i-1)*2+1)) {
System.out.print("*");
} else
System.out.print(" ");
}
}
else {
for(int a=1; a<20;a++) {
if(a%2!=0)
System.out.print("*");
else
System.out.print(" ");
}
}
System.out.println();
}
}
}
|
|