9行 实心菱形
作者:互联网
for 小实例
使用for循环
打印一个9行的 实心菱形
{
int r=7;
int t=0;
for(int i=0;i<=5;i++){
for (int j1 = 1; j1 <=5-i; j1++) {
System.out.print(" ");
}
t=2*i-1;
for (int j = 0; j < t; j++) {
System.out.print("*");
}
System.out.println();
}
for (int y = 0; y<=3; y++) {
for (int i1 = 1; i1 <=y+1; i1++) {
System.out.print(" ");
}
r=7-(2*y);
for (int z = 0; z < r; z++) {
System.out.print("*");
}
System.out.println();
}
System.out.println();
}
输出结果:
~~~java
*
***
*****
*******
*********
*******
*****
***
*
标签:i1,int,System,println,菱形,print,实心,out 来源: https://blog.csdn.net/qq_45893905/article/details/112404246