Star Printing 9
Time limit1sMemory limit128 MB
Print an hourglass-shaped star pattern of stars and spaces based on an integer N.
- Level
Easy1 of 10
- Topics
- Implementation
- Solved
- No attempts yet
Problem
Given an integer N, print an hourglass-shaped star pattern whose number of stars decreases by 2 toward the center and then increases by 2 again.
The pattern has 2 × N - 1 lines. In the upper half, each next line has one more leading space and two fewer stars. The middle line contains one star, and the lower half is symmetric with the upper half.
Input
The first line contains an integer N.
1 ≤ N ≤ 100
Output
Print the star pattern from the first line through line 2 × N - 1.
Do not print unnecessary spaces at the end of any line.