使用*号,打印等边三角形

来源:互联网 发布:安卓本子软件 编辑:程序博客网 时间:2024/04/30 15:50
/**使用*号,打印等边三角形*/public class Test{public static void main(String[] args){for (int x=0; x<5; x++) { for (int y=x+1; y<5; y++) {  System.out.print(" "); } for (int z=0; z<=x; z++) {  System.out.print("* "); } System.out.println();}}}/**    *   * *  * * * * * * ** * * * **/

原创粉丝点击