Patter question no 7

how to solve it m not getting the approach

Just think of it this way. You first need to print a line of n asterisks. Then for n - 2 lines you need to print asterisk followed by n - 2 spaces followed by an asterisk. Then simply print another line similar to the first line.