Star Pattern 17
Time limit1sMemory limit256 MB
Print a hollow isosceles triangle of height N, with stars on the two sides and a solid star base.
- Level
Easy1 of 10
- Topics
- Implementation
- Solved
- No attempts yet
Problem
Draw the outline of a hollow isosceles triangle with stars (*) and spaces.
Given the height , build line (where ) with this rule. Print spaces first, then one of the following.
- If , print stars in a row.
- If , print a single star.
- On every other line, print one star, then spaces, then one more star.
When , the first rule and the second rule produce the same line.
Input
The first line contains an integer . ()
Output
Print the lines built by the rule above in order, from the first line to line .