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, ...

Pattern-9

Description:          This program prints the following pattern:                                         ********                                         ***  ***                                         **    **                                         *      *                                         **    **                                         ***  ***                                         ******** Primary Inputs:    None Primary Output:    The pattern specified above Platform Used:      JDK 1.6 with JCreator   Java class Pattern9 { public static void main(String args[]) { String s1 = "*"; int i, j, l = 8, x = 8, y ...

Pattern-8

Description:          This program prints the following pattern(Vertical Histogram):                                     if the array is of elements -|3|7|2|5|                                                                              *                                      *                      ...

Pattern-7

Description:          This program prints the following pattern(Horizontal Histogram):                                     if the array is of elements -|3|7|2|5|                                      ***                                      *******                                      **                                    ...

Pattern-6

Description:          This program prints the following pattern:                                      1                                     121                                   12321                                 1234321                               123454321 Primary Inputs:    Generates a single digit random number Primary Output:    The pattern specified above Platform Used:      JDK 1.6 with JCreator   Java //Primary Input : Generates a single digit number (n) representing the number of lines /* Primary Output: The following pattern is ...

Pattern-5

Description:          This program prints the following pattern: * ** *** **** 1234    *  ** ******* Primary Inputs:    Generates a single digit random number Primary Output:    The pattern specified above Platform Used:      JDK 1.6 with JCreator   Java //Primary Input : Generates a single digit number (n) representing the number of lines /* Primary Output: The following pattern is generated for ...

Pattern-4

Description:          This program prints the following pattern:                                      0                                      12                                      345                                      6789                                      01234 Primary Inputs:    Generates a single digit random number Primary Output:    The pattern specified above Platform Used:      JDK 1.6 with JCreator   Java //Primary Input : Generates a single digit number (n) representing the number of lines /* Primary Output: The following pattern is generated for n lines ...

Pattern-3

Description:          This program prints the following pattern:                                      0                                      10                                      101                                      0101                                      01010  Primary Inputs:    Generates a single digit random number Primary Output:    The pattern specified above Platform Used:      JDK 1.6 with JCreator   Java //Primary Input : Generates a single digit number (n) representing the number of lines /* Primary Output: The following pattern is generated for n lines ...

Pattern-2

Description:          This program prints the following pattern:                                      1                                      222                                      33333                                      4444444 Primary Inputs:    Generates a single digit random number as the number of lines Primary Output:    The pattern specified above Platform Used:      JDK 1.6 with JCreator   Java //Primary Input : Generates a single digit number (n) representing the number of lines /* Primary Output: The following pattern ...

Pattern-1

Description:          This program prints the following pattern:                                      1                                      22                                      333                                      4444  Primary Inputs:    Generates a single digit random number Primary Output:    The pattern specified above Platform Used:      JDK 1.6 with JCreator   Java //Primary Input : Generates a single digit number (n) representing the number of lines /* Primary Output: The following pattern is generated for n lines ...