public class Demo11 {
public static void main(String[] args) {
for (int i = 1; i <= 9; i++) {
for (int j = 1; j <= 9- i; j++) {
System.out.print(" ");
}
for (int j = 1; j <= 2 * i - 1; j++) {
System.out.print("*");
}
System.out.println();
}
{
for (int i=1;i<=8;i++) {
for (int j=1;j<=i;j++) {
System.out.print(" ");
}
for (int j=1;j<=2*(8-i)+1;j++) {
System.out.print("*");
}
System.out.println();
}
}
}
}
JAVA小练习11——实心菱形
最新推荐文章于 2022-07-21 17:09:50 发布