java实现等腰三角形

public class Demo {

    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();
        }
    }
    
}

效果图:

  

猜你喜欢

转载自blog.csdn.net/qq_40386113/article/details/83572790
今日推荐