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,
( Essence )2020 year 6 month 26 day C# Class library GUID Help class SpringMVC Frame in controller Layer gets the property value of the custom configuration file common 5 species JAVA Runtime exception inherit jpa Repository Write custom method query Python realization switch method keras Data generator -- Data enhancement Share has surpassed Ningde Era !LG Chemical confirmation to spin off battery business unit jmeter-while Summary of controller use ajax get Request Chinese parameter garbled solution vs2017, establish C++Win32 Windows Forms Application