2/02/2012

C# Number Pattern (26)

C# Number Pattern (26)
C# Number Pattern (26)

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

No comments:

Post a Comment