zoukankan      html  css  js  c++  java
  • 20130330java基础学习笔记语句_for循环嵌套练习2

    class ForForTest
    {
        public static void main(String[] args)
        {
            /*用for循环做出以下图:
            * * * * *
             * * * *
              * * *
               * *
                *
            */
            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();
            }
        }
    }

    //方法二:

    public class Test2
    {
        public static void main(String[] args)
        {
            String s = "";
            String x ="";
            for (int i = 5; i > 0; i--)
            {
                x ="";
                System.out.print(s);
                for (int j = 0; j < i; j++)
                {
                    x += "* ";
                }
                s += " ";
                System.out.print(x);
                System.out.println();
            }
        }
    }

  • 相关阅读:
    windows10远程桌面慢的解决
    linux挂载windows共享盘
    ORACLE 临时表空间满了的原因解决方案
    oracle临时表空间扩容
    expdp/impdp 数据泵导入导出
    Oracle Awr报告_生成
    mysql备份与保存
    oracle lsnrctl监听器多实例配置
    RabbitMQ
    docker stop 容器时 不能将我指定的容器停掉
  • 原文地址:https://www.cnblogs.com/lisu/p/2990693.html
Copyright © 2011-2022 走看看