ForForDemo

public class ForFor99Demo {
    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"+x+"="+x*y+"\t");
            }
            System.out.println();
        }
//      System.out.println("\\Hellow\tWorld\\");    
        /*
         * \n 回车键;
         * \t 制表符;
         * \b 退格;
         * \r 按下回车键
         */
    }
}

public class ForForDemo {

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

//      
//      for(int x=0;x<4;x++) {  //外循环控制的是次数
//          for(int y=0;y<5;y++) {  //内循环控制的是每一行的个数
//              System.out.print("*");
//          }
//          System.out.println();
//      }
//      

        for(int a=0;a<4;a++) {
            for(int b=0;b<5;b++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }
}

public class ForForTest {

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

         *****
         ****
         ***
         **
         *

         */

        /*
        int z = 5 ;
        for(int x=1;x<=5;x++) { 
            for(int y=1;y<=z;y++) { //1-5 1-4 1-3 1-2 
                System.out.print("*"); 
            }
            System.out.println();
            z-- ;
        }
        */

        /*
        int z = 1 ;
        for(int x=1;x<=5;x++) { 
            for(int y=z;y<=5;y++) { //1-5 2-5 3-5 4-5 
                System.out.print("*"); 
            }
            System.out.println();
            z++ ;
        }
        */

        /*
        for(int x=5;x>=1;x--) { 
            for(int y=1;y<=x;y++) { //1-5 2-5 3-5 4-5 
                System.out.print("*"); 
            }
            System.out.println();
        }
        */

        for(int x=1;x<=5;x++) { 
            for(int y=x;y<=5;y++) { //1-5 2-5 3-5 4-5 
                System.out.print("*"); 
            }
            System.out.println();
        }
    }
}

public class ForForTest2 {

    public static void main(String[] args) {
        /*
         * 
         **
         ***
         ****
         ***** 
         */
        for(int x=1;x<=5;x++) {
            for(int y=1;y<=x;y++) {
                System.out.print("*");
            }
            System.out.println();
        }
        System.out.println("------------------------------");
        /*
         * 54321
         * 5432
         * 543
         * 54
         * 5
         */
        for(int x=1;x<=5;x++) {
            for(int y=5;y>=x;y--) {
                System.out.print(y);
            }
            System.out.println();
        }
        System.out.println("------------------------------");
        /*
         * 1
         * 22
         * 333
         * 4444
         * 55555
         */
        for(int x=1;x<=5;x++) {
            for(int y=1;y<=x;y++) {
                System.out.print(x);
            }
            System.out.println();
        }
    }
}

public class ForForTest3 {

    public static void main(String[] args) {
        /*
         * * * * *
         -* * * *
         --* * *
         ---* *
         ----*        
         */
        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();
        }
        System.out.println("--------------------------------------");

        /*
         ----* 
         ---* *
         --* * * 
         -* * * *
         * * * * * 
         */
        for(int x=1;x<=5;x++) {
            for(int y=4;y>=x;y--) {
                System.out.print(" ");
            }
            for(int z=1;z<=x;z++) {
                System.out.print("* ");
            }
            System.out.println();
        }

    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值