/ Patterns / pattern_7.java
pattern_7.java
 1  /*
 2   * Write code to print the followinf pattern 
 3   * *
 4   * **
 5   * ***
 6   * ****
 7   * *****
 8   * ****
 9   * ***
10   * **
11   * *
12   */ 
13  
14  public class pattern_7 {
15    public static void main(String[] args) {
16      int n = 5; 
17  
18      for(int i = 1; i <= n; i++) {
19        for(int j = 1; j <= i; j++) {
20          System.out.print("* ");
21        }
22        System.out.println();
23      }
24  
25      for(int i = (n - 1); i >= 1; i--) {
26        for(int j = 1; j <= i; j++) {
27          System.out.print("* ");
28        }
29        System.out.println();
30      }
31    }
32  }