Again inspired by a task for Programming 101 here's another challenge.
- A positive integer
n >= 3. (has to be odd)
nlines of asterisks, where the first line has
nasterisks and every new line has two asterisks less than the line before. Until hitting 1 asterisk. From there every new line has two asterisks more than the line before until getting back to
nasterisks. Spaces or something like spaces have to used to align the asterisks so that it really will look like an hourglass.
- Trailing newlines are allowed but do not have to be used.
- indentation is a must.
- This is code-golf, so shortest answer in bytes wins.
- Since the course is taught in C++, I'm eager to see solutions in C++.
Test case (n=5):
***** *** * *** *****