1, Print five rows and five columns of rectangles first

*****

*****

*****

*****

*****

The code is as follows :

for(int i=1;i<=5;i++) {
            for(int j=1;j<=5;j++){
                System.out.print("*");
            }
            System.out.println();
        }

2, Print right triangle with tip down

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

    for(int i=1;i<=5;i++) {
            for(int j=i;j<=5;j++){
                System.out.print("*");
            }
            System.out.println();
        }

3, Print right triangle with tip up

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

4, Print reverse an isosceles triangle

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

for(int i=1;i<=5;i++) {
            for(int j=1;j<=i;j++){
                System.out.print(" ");// Space in quotation marks
            }
            for(int z=i;z<=5;z++) {
                System.out.print("* ");// In quotes are asterisks and spaces
            }
            System.out.println();
        } 

5, Print isosceles triangle

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

for(int i=1;i<=5;i++) {
            for(int j=i;j<=5;j++){
                System.out.print(" ");// Space in quotation marks
            }
            for(int z=1;z<=i;z++) {
                System.out.print("* ");// In quotes are asterisks and spaces
            }
            System.out.println();
        }

6, Print digital graphics

54321
5432
543
54
5

for(int i=1;i<=5;i++) {
            for(int j=5;j>=i;j--){
                System.out.print(j);
            }
            System.out.println();
        }

7 Print digital graphics

1
22
333
4444
55555

for(int i=1;i<=5;i++) {
            for(int j=1;j<=i;j++){
                System.out.print(i);
            }
            System.out.println();
        }

 

Technology
©2019-2020 Toolsou All rights reserved,
It's unexpected Python Cherry tree (turtle The gorgeous style of Library )Unity3D of UGUI Basics -- Three modes of canvas os Simple use of module computer network --- Basic concepts of computer network ( agreement , system )html Writing about cherry trees , Writing about cherry trees Some East 14 Pay change 16 salary , Sincerity or routine ?Unity-Demo Examples ✨ realization UI- Backpack equipment drag function 06【 Interpretation according to the frame 】 Data range filtering -- awesome java Four functional interfaces ( a key , simple )