Skip to content

A collection of Java code files that demonstrate various pattern printing techniques.

License

Notifications You must be signed in to change notification settings

Manjeet-Agarwal/Patterns-in-Java

Repository files navigation

Patterns-in-Java

Welcome to the Pattern Printing Repository! This repository contains code files that demonstrate various interesting patterns using Java programming language.

Each code file is dedicated to a specific pattern, including the butterfly, diamond shape, and different variations of star and number patterns,as well as solid and hollow rhombus patterns.

Patterns

  1. Butterfly Pattern:Butterfly_pattern.java

    • This program prints a beautiful butterfly pattern using asterisks (*).

    • Example output:

           *        *
           **      **
           ***    ***
           ****  ****
           **********
           **********
           ****  ****
           ***    ***
           **      **
           *        *
      
      
  2. Diamond Shape Pattern: diamond.java

    • This program prints a diamond shape pattern using spaces and asterisks (*).
    • Example output:
             *
           * * *
         * * * * *
       * * * * * * *
         * * * * *
           * * *
             *
      
  3. Star Patterns:star_patterns.java

    • This program demonstrates different star patterns such as the right triangle, left triangle, and pyramid.

    • Example output (right triangle):

      *
      * *
      * * *
      * * * *
      * * * * *
      
                *
              * *
            * * *
          * * * *
        * * * * *
      
    
    
         *
        * *
       * * *
      * * * *
     * * * * *
    
  4. Number Patterns: Numbers_patterns.java

    • This program showcases various number patterns including the number pyramid and number staircase.

    • Example output (number pyramid):

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

      #Flyod's Triangle

          1 
          2 3
          4 5 6
          7 8 9 10
          11 12 13 14 15
      

    0-1 pattern

    1
    0 1
    1 0 1
    0 1 0 1
    1 0 1 0 1
    

    palindromic numbers print

        1
       212
      32123
     4321234
    543212345
    
    
  5. Solid and Hollow Rhombus Patterns:rhombus_pattern.java

  • Solid Rhombus:

    • This program prints a solid rhombus pattern using asterisks (*).
    • Example output:
          *****
         *****
        *****
       *****
      *****
      
  • Hollow Rhombus:

    • This program prints a hollow rhombus pattern using spaces and asterisks (*).
    • Example output:
          *****
         *   *
        *   *
       *   *
      *****
      
  1. arrowhead pattern : arrow_head_pattern

Example Output:

*
**
***
****
***
**
*
  1. hourglass pattern: hourglass.java

Example Output:

*****
 ***
  *
 ***
*****
  1. sprial number : spiral_nos_pattern

Example Output:

1   2   3   4   5 
16  17  18  19   6 
15  24  25  20   7 
14  23  22  21   8 
13  12  11  10   9      

  1. Hollow Diamond: hollow_diamond.java

Example Output:

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

Feel free to explore each code file to understand the logic behind the patterns and run them in your Java development environment.

If you have suggestions for more amazing patterns or would like to contribute to this repository, please feel free to open an issue or submit a pull request. I will always appreciate your ideas and contributions!

About

A collection of Java code files that demonstrate various pattern printing techniques.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages