for循环打印乘法口诀

来源:互联网 发布:淘宝追加评价怎么删除 编辑:程序博客网 时间:2024/04/29 21:36


/*
  \n:回车
  \t:制表符
  \b:退格
  \r:按下回车键转译字符,对 \ 后面的字符进行编译
  \:

乘法口诀
*/

class  ifDemo
{
    public static void main(String[] args)
    {
        for(int x=1;x<=9;x++)
        {
            for(int y =1;y<=x;y++)
            {
                System.out.print(y + "*" + x + "=" + y*x + " ");
            }
            System.out.print("\n");
            System.out.println("\"hello word\"");
        }

    }
}



//编译一个 倒三角的 等腰 星号

class  ifDemo
{
    public static void main(String[] args)
    {
        for(int x=1;x<=4;x++)
        {
            for(int y=1; y<=x;y++)
            {
                System.out.print(" ");

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


        }


    }
}



0 0