C# code to display the asterisk pattern

Practical : 5
Subject : .NET
Aim : Write C# code to display the asterisk pattern as shown below:
*****
*****
*****
*****
*****




Code:

using System;

class Program

{
    static void Main(string[] args)
    {
        int n = 5,i,j;
        for(i=1;i<=n;i++)
        {
            for (j =1; j <= n; j++)
            {
                Console.Write("*");
               
            }
            Console.Write("\n");
        }
Console.ReadKey();
    }
}


Output:

Previous
Next Post »

Ads