Back to Patterns
Alphabet H Pattern
Pattern Result
* ** ** ********* ** ** *
Code Implementation
Explanation
The Alphabet H Pattern creates a shape that resembles the letter H using asterisks. The pattern consists of three parts: the top vertical part, the middle horizontal line, and the bottom vertical part. The algorithm ensures that n is odd to create a symmetrical H. The vertical parts are created by placing stars at the first and last positions, with spaces in between. The middle horizontal line is created by filling the entire row with stars. This creates the distinctive shape of the letter H with two vertical lines connected by a horizontal line in the middle.