/*
需求:请输出下列的形状
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
*/
class ForFor_FangKuan {
public static void main(String[] args) {
for (int x=1;x<=5 ;x++ ) {
for (int y=x;y<=5;y++ ) {
System.out.print(" ");
}
for (int y=1;y<=x ;y++ ) {
System.out.print("*"+" ");
}
System.out.println();
}
//System.out.println("-----------------------"); //换行
for (int x=1;x<=4 ;x++ ) {
for (int y=1;y<=x+1;y++ ) {
System.out.print(" ");
}
for (int y=x;y<=4 ;y++ ) {
System.out.print("* ");
}
System.out.println();
}
}
}
没显示出来, - - 刚来JAVA基础班的小白,自己玩玩。 |