8/01/2011

C# Star Pattern (5)

C# Star Pattern (5)
C# Star Pattern (5)


/* C# program to print the following pattern   
     *  
    ***   
   *****  
  *******  
 *********  */   
 namespace Patterns   
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       int i, j, k;  
       for (i = 1; i <= 5; i++)  
       {  
         for (j = i; j < 5; j++)  
         {  
           Console.Write(" ");  
         }  
         for (k = 1; k < (i * 2); k++)  
         {  
           Console.Write("*");  
         }  
         Console.WriteLine();  
       }      
     }  
   }  
 }

No comments:

Post a Comment