您的位置:首页 > 其它

for 循环 嵌套练习

2016-07-26 22:07 274 查看
 /*  * * * * *

  * -* * * *

  * --  * * *

  * ---   * *

  *  ----   *

  *  -----

  */ 

 public class IfTest {

 public static void main(String [] args){

    for(int x=1;x<=5;x++){//代表的行数

    
for(int y=1;y<=x;y++) {//代表的列数

    

    System.out.print("☆");

    }

for(int z = x; z<=5;z++){//倒三角形状

    System.out.print("* ");

    
}

       System.out.println();
    }

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: