logoStarPatterns
Back to Patterns

Alphabet I Pattern

Pattern Result

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

Code Implementation

Explanation

The Alphabet I Pattern creates a shape that resembles the letter I using asterisks. The pattern consists of three parts: the top horizontal line, the middle vertical part, and the bottom horizontal line. The algorithm ensures that n is odd to create a symmetrical I. The horizontal lines are created by filling the entire row with stars. The middle vertical part is created by placing a star in the middle of each row, with spaces on both sides. This creates the distinctive shape of the letter I with two horizontal lines connected by a vertical line in the middle.