2/02/2012

C# Number Pattern (15)

C# Number Pattern (15)
C# Number Pattern (15)

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

No comments:

Post a Comment