logoStarPatterns
Back to Patterns

Alphabet R Pattern

Pattern Result

******
* *
* *
******
* *
* *
* *

Code Implementation

Explanation

The Alphabet R Pattern creates a shape that resembles the letter R using asterisks. The pattern consists of four parts: the top horizontal line, the top curved part, the middle horizontal line, and the bottom diagonal part. The horizontal lines are created by filling a portion of the row with stars. The top curved part is created by placing stars at the first and last positions, with spaces in between. The bottom diagonal part is created by placing a star at the first position and another star at a position that increases with each row to create a diagonal line. This creates the distinctive shape of the letter R with a vertical line on the left, a closed loop at the top, and a diagonal leg at the bottom.