Skip to content

FahimFBA/pattern-printing-java

Repository files navigation

pattern-printing-java

GitHub Workflow Status Total Lines of Code License

Note

  1. Number of lines = number of rows = number times the outer loop will run
  2. Identify for every row numbers, how many columns are there or types of elements in the column
  3. What do you need to print
  4. Try to find the formula relating rows and columns

Patterns Covered Here (Using Java)

Pattern 1

* 
* * 
* * * 
* * * * 

Pattern 2

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

Pattern 3

* * * * 
* * * 
* * 
* 

Pattern 4

1 
1 2 
1 2 3 
1 2 3 4 

Pattern 5

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

Pattern 6

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

Pattern 7

        1 
      2 1 2 
    3 2 1 2 3 
  4 3 2 1 2 3 4 
5 4 3 2 1 2 3 4 5

Pattern 8

        1 
      2 1 2 
    3 2 1 2 3 
  4 3 2 1 2 3 4 
5 4 3 2 1 2 3 4 5
  4 3 2 1 2 3 4
    3 2 1 2 3
      2 1 2
        1

Pattern 9

4 4 4 4 4 4 4 4 4 
4 3 3 3 3 3 3 3 4 
4 3 2 2 2 2 2 3 4 
4 3 2 1 1 1 2 3 4 
4 3 2 1 0 1 2 3 4
4 3 2 1 1 1 2 3 4
4 3 2 2 2 2 2 3 4
4 3 3 3 3 3 3 3 4
4 4 4 4 4 4 4 4 4