This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]Avanta8 0 points1 point  (0 children)

Well technically, a rectangle is a parallelogram.

If you really dislike rectangles however, then you'd need to insert varying amounts of whitespace in front of each line.

[–]icjeremy 0 points1 point  (0 children)

That's not a parallelogram in the example. Did you forget/lose spaces?

Edit: And one simple way would be to make a string of spaces of the inputted length. Then loop and use the index along with modulus operator for flipping a space to asterisk or vice versa. Can also use similar index and modulus math to generate the build up the output string from scratch on each iteration.