VOOZH about

URL: https://www.geeksforgeeks.org/dsa/print-the-alphabets-a-to-z-in-star-pattern/

⇱ Print the Alphabets A to Z in Star Pattern - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Print the Alphabets A to Z in Star Pattern

Last Updated : 12 Jul, 2025

Given any alphabet between A to Z, the task is to print the pattern of the given alphabet using star.

Examples: 

Input: A
Output: 
 ** 
 * * 
 ****** 
 * * 
* *

Input: P
Output:
***** 
* *
***** 
* 
* 

Approach: The code to print each alphabet is created in a separate function. Use switch statement to call the desired function on the basis of the alphabet's pattern required.

Below is the implementation.  


Output: 
 ** 
 * * 
 ****** 
 * * 
* *

 

Time complexity: O(h^2) where h is height of the alphabet

Auxiliary space: O(1)

Comment