2/02/2012

C# Number Pattern (22)

C# Number Pattern (22)
C# Number Pattern (22)

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

No comments:

Post a Comment