Star Pattern Program in C#

This console program show how to print star pattern in C# like triangle pattern.

Program of star pattern in c# console application


    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace starpatterns
    {
        class Program
        {
            static void Main(string[] args)
            {
               int value = 5;
               int i, j, k;
               Console.WriteLine("PRINTING THE STAR.");
               for (i = 1; i <= value; i++)
               {
                  for (j = 1; j <= value-i; j++)
                  { 
                  }
                  for (k = 1; k <= i; k++)
                  {
                      Console.Write("*");
                  }
                  Console.WriteLine("");
               }
               Console.ReadLine();
            }
        }
    }	
	

Output

	
   PRINTING THE STAR.
   *
   * *
   * * *
   * * * *
   * * * * *
           

Post Your Comment