搜索
您的当前位置:首页正文

打印等腰三角形

来源:步旅网
/*
----*
---* *
--* * *
-* * * *
* * * * *
*/

/*class Day03111
{
    public static void main (String[] args)

    {

        //控制行数

        for(int x=0;x<5;x++)

        {

            //打印“—”

            for(int y=x;y<5;y++)
            {
              System.out.print("-");

            }

            //打印*和一个空格

            for(int z=0;z<=x;z++)
            {
              System.out.print("* ");
            }

        System.out.println();
        }
    }
}
*/

class Day03111
{
    public static void main (String[] args)
   {
     for(int x=0;x<5;x++)
    {
         for(int y=1;y<x+1;y++)
        {
         System.out.print("-");
        }
        for(int z=5;z>x;z--)
        {
        System.out.print("* ");
        }
         System.out.println();
    }
   }
}

/*
* * * * *
 * * * *
  * * *
   * *
    *
*/








因篇幅问题不能全部显示,请点此查看更多更全内容

Top