Pattern

3.9

72 votes
Problem

Given 'n', print the symbol 'Z' spanning n rows using '*' symbol. Value of n>2 and n<=20.

Example:
1) Input : n=3
Output:
***
 *
***

2) Input n=4
Output:
****
  *
 *
****
Sample Input
5
Sample Output
*****
   *
  *
 *
*****
Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

The 'Z' is printed across 5 lines as shown above.

Editor Image

?