2/02/2012

C# Number Pattern (23)

C# Number Pattern (23)
C# Number Pattern (23)


/* C# program to print the following pattern   
 12344321  
 123**321  
 12****21  
 1******1  */  
 namespace Patterns  
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       int i, j, k;  
       for (i = 4; i >= 1; i--)  
       {  
         for (j = 1; j <= 4; j++)  
         {  
           if (j <= i)  
             Console.Write(j);  
           else  
             Console.Write(" ");  
         }  
         for (j = 4; j >= 1; j--)  
         {  
           if (j <= i)  
             Console.Write(j);  
           else  
             Console.Write(" ");  
         }   
         Console.WriteLine();  
       }        
     }  
   }  
 }  

No comments:

Post a Comment