Write a program or function that takes in a positive integer (via stdin, command line, or function arg) and prints or returns a string of that many of these small triangles tiled together, alternating which way they point:
/\ /__\ This sole triangle is the output if the input is 1.
If the input is 2, the output is
____ /\ / /__\/ If the input is 3, the output is
____ /\ /\ /__\/__\ If the input is 4, the output is
________ /\ /\ / /__\/__\/ And so on. Your program must support inputs up to 216 - 1 = 65535.
Details
- The leftmost triangle always points upwards.
- There may be trailing spaces but there may not be unnecessary leading spaces.
- There may be an optional trailing newline.
- Note that for
1the output is two lines long but otherwise it's three. This is required. - The shortest submission in bytes wins.