image.png
System.out.println("1.第四题");
int x = 9;
for (int i = 1; i <= x; i++) {
for (int j = 1; j <= x - i; j++) {
System.out.print(" ");
}
for (int k = 1; k <= 2 * i - 1; k++) {
int num = 2 * i - 1;
if(i < ((x / 2) + 2)) {
continue;
}else if(k>( num / 2 -(9 - i)) && k<(num / 2 + (11 - i))){
System.out.print(" ");
continue;
}
System.out.print("*");
}
if(i>4){
System.out.println();
}
Thread.sleep(100);
}
for (int i = 1; i < x; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(" ");
}
for (int k = 1; k <= 2 * (x - i) - 1; k++) {
System.out.print("*");
}
System.out.println();
Thread.sleep(100);
}
网友评论