Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Comments on Tile pyramids on top of each other!

Post

Tile pyramids on top of each other!

+4
−0

The task

Given a positive integer as input, output tiled pyramids of this height.

How?

Let's say the inputted integer was n. From there, we output n lines of output, each having:

  1. A decreasing indentation of spaces starting with n-1 spaces and ending with 0 spaces
  2. An increasing number of the symbol / starting with 1 symbol and ending with n symbols
  3. An increasing number of the symbol \ starting with 1 symbol and ending with n symbols

For example, with an input of 4, the output should be the following:

   /\
  //\\
 ///\\\
////\\\\

Rules

  1. You may output an optional newline after the required output
  2. Input will always be a positive integer
  3. This is code-golf, so lowest byte-count for each language is the winner

Test cases

Input: 1
Output:
/\


Input: 7
Output:
      /\
     //\\
    ///\\\
   ////\\\\
  /////\\\\\
 //////\\\\\\
///////\\\\\\\


Input: 11
Output:
          /\
         //\\
        ///\\\
       ////\\\\
      /////\\\\\
     //////\\\\\\
    ///////\\\\\\\
   ////////\\\\\\\\
  /////////\\\\\\\\\
 //////////\\\\\\\\\\
///////////\\\\\\\\\\\
History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Is the input being a Unicode character (e.g. a newline means 10, "!" means 33, etc) allowed? (1 comment)
Is the input being a Unicode character (e.g. a newline means 10, "!" means 33, etc) allowed?
22t‭ wrote over 3 years ago

Is the input being a Unicode character (e.g. a newline means 10, "!" means 33, etc) allowed?