For n = 5

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

**Program**

public class Pattern { public void print(int n) { for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { System.out.print("*"); } System.out.println(); } for (int i = n - 1; i >= 1; i--) { for (int j = 1; j <= i; j++) { System.out.print("*"); } System.out.println(); } } }

The given pattern can be split into two parts. The first part is :

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

And the second part is

**** *** ** *

The first part is the same as this pattern. The second part is same as this pattern with n replaced with n-1.

Amazing work there! Regards.