2/02/2012

C# Number Pattern (25)

C# Number Pattern (25)
C# Number Pattern (25)


/* C# program to print the following pattern   
 11111  
 2222  
 333  
 22  
 1  */  
 namespace Patterns  
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       int i, j;  
       for (i = 1; i <= 5; i++)  
       {  
         for (j = 5; j >= i; j--)  
         {  
           if (i <= 3)  
             Console.Write(i);  
           else  
             Console.Write(6 - i);  
         }  
         Console.WriteLine();  
       }        
     }  
   }  
 } 

No comments:

Post a Comment