Menayer

Tech enthusiast, .NET developer, and blogger — sharing ideas, code, and practical solutions that make work smarter.


Menayer's Patterns post

Pattern Series – Square Star Pattern

Categories: , ,

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.

Square Star Pattern

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

Let’s move to the code example

Create a Static Class named SquareStarPattern

    public static class SquareStarPattern
    {
        public static void PrintSquareStarPattern(int n)
        {
            int i,j;

            for(i =0; i < n; i++)
            {
                for(j=0; j < n; j++)
                {
                    Console.Write("* ");
                }
                Console.WriteLine();
            }

        }
    }

Then call the method in Program.cs

SquareStarPattern.PrintSquareStarPattern(4);

That’s it