Patterns

  • The codes under the Patterns section can be used to print various patterns of numbers &/or stars(*). The specific pattern to be printed is specified on the program page.
  • The basic purpose here is to give the feel of the logic. Being similar to C/C++, the logic codes may be useful in these languages too, or, they can be used with slight modifications to get another pattern. 

For easy access the  list of the patterns is also provided here with respective links:
 (Following links open in new window)
  • Pattern 1 This program prints the following pattern
                        1
                        22
                        333
                        4444
  • Pattern 2 This program prints the following pattern
                        1
                        222
                        33333
                        4444444
  • Pattern 3This program prints the following pattern
                                     0

                                     10
                                     101
                                     0101
                                     01010 
  • Pattern 4 This program prints the following pattern
                                     0

                                     12
                                     345
                                     6789
                                     01234
  • Pattern 5This program prints the following pattern
                                     *

                                    **
                                   ***
                                  ****
  •  Pattern 6 This program prints the following pattern
                                     1

                                    121
                                  12321
                                1234321
                              123454321
  • Pattern 7 This program prints the following pattern (Horizontal Histogram)
                                     ***

                                     *******
                                     **
                                     *****
  • Pattern 8This program prints the following pattern (Vertical Histogram)
                                     *
                                     *
                                     * *
                                     * *
                                    ** *
                                    ****
                                    **** 
  • Pattern 9 This program prints the following pattern
                                        ********
                                        ***  ***
                                        **    **
                                        *      *
                                        **    **
                                        ***  ***
                                        ********                                  

 

 

Rate this post

Leave a Reply