program to print patterns
Patterns for a triangle and a 'x' pattern
TRIANGLE PATTERN
  ------*
       * * 
      * * * 
     * * * * 
    * * * * * 
This pattern has some generality
i  | number of stars  | number of spaces  | 
1  | 1  | 4  | 
2  | 2 | 3  | 
3  | 3  | 2  | 
4  | 4  | 1  | 
5  | 5  | 0  | 
Two loops are used because there are rows and columns .
The snippet is

X PATTERN 


The first pattern is "X" pattern when number of rows is "ODD"
If the pattern is "X" pattern when number of rows is "EVEN"
code

The pattern is 
i  | j  | 
1  | 1  | 
2  | 2  | 
3  | 3  | 
4  | 4  | 
5  | 5  | 
I HOPE THIS HELPS........
HAPPY CODING..............