Pattern Series – Hollow Square Star Pattern.
Menayer
October 19, 2025 // 1 MIN READ
In this post, we’ll explore how to create star-shaped patterns using simple loops in C#.
These exercises may look basic, but they build the foundation for problem-solving and logic — skills every developer needs.
Hollow Square Star Pattern
****
* *
* *
****
Let’s move to the code example
Create a Static Class named HollowSquareStarPattern
public static void HollowSquareStarPatternFast(int n)
{
int i, j;
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
if (i == 0 || i == n - 1 || j == 0 || j == n - 1)
Console.Write("* ");
else
Console.Write(" ");
}
Console.WriteLine();
}
}
Then call the method in Program.cs

That’s it
Protocol // Share Link
Main Contributor //
Menayer
I'm a .NET developer who enjoys building clean, reliable, and scalable software. I specialize in enterprise applications, automation, and data-driven solutions, with extensive experience in the Container Terminal industry.