2/02/2012

C# Number Pattern (28)

C# Number Pattern (28)
C# Number Pattern (28)


/* C# program to print the following pattern   
 0   
 909   
 89098   
 7890987   
 678909876   
 56789098765   
 4567890987654   
 345678909876543   
 23456789098765432   
 1234567890987654321   */  
 namespace Patterns   
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       int i, j;  
       Console.WriteLine("0");  
       for (i = 9; i >= 1; i--)  
       {  
         for (j = i; j <= 9; j++)  
           Console.Write( j);  
         Console.Write("0");  
         for (j = 9; j >= i; j--)  
           Console.Write(j);  
         Console.WriteLine();  
       }      
     }  
   }  
 }  

C# Number Pattern (27)

C# Number Pattern (27)
C# Number Pattern (27)

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

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();  
       }        
     }  
   }  
 }  

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();  
       }        
     }  
   }  
 } 

C# Number Pattern (24)

C# Number Pattern (24)
C# Number Pattern (24)

1:  /* C# program to print the following pattern   
2:    1  
3:   2 3 4  
4:  5 6 7 8 9   */  
5:  namespace Patterns  
6:  {  
7:    class Program  
8:    {  
9:      static void Main(string[] args)  
10:      {  
11:        int i, j, k;  
12:        k = 1;  
13:        for (i = 1; i &lt;= 5; i += 2)  
14:        {  
15:          for (j = 5; j &gt;= 1; j--)  
16:          {  
17:            if (j &gt; i)  
18:              Console.Write(" ");  
19:            else  
20:              Console.Write(" " + k++);  
21:          } Console.WriteLine();  
22:        }        
23:      }  
24:    }  
25:  }  

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();  
       }        
     }  
   }  
 }  

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();  
       }        
     }  
   }  
 }  

C# Number Pattern (21)

C# Number Pattern (21)
C# Number Pattern (21)

 /* C# program to print the following pattern   
 1   
 2 6   
 3 7 10   
 4 8 11 13   
 5 9 12 14 15  */  
 namespace Patterns  
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       int i, j, k;  
       for (i = 1; i <= 5; i++)  
       {  
         k = i;  
         for (j = 1; j <= i; j++)  
         {  
           Console.Write(k);  
           k += 5 - j;  
         }  
         Console.WriteLine();  
       }        
     }  
   }  
 }  

C# Number Pattern (20)

C# Number Pattern (20)
C# Number Pattern (20)

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

C# Number Pattern (19)

C# Number Pattern (19)
C# Number Pattern (19)

 /* C# program to print the following pattern   
 1  
 23  
 456  
 78910  */  
 namespace Patterns  
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       int i, j, k;  
       k = 1;  
       for (i = 1; i < 5; i++)  
       {  
         for (j = 1; j <= i; j++)  
         {  
           Console.Write(k++);  
         }  
         Console.WriteLine();  
       }        
     }  
   }  
 }  

C# Number Pattern (18)

C# Number Pattern (18)
C# Number Pattern (18)

 /* C# program to print the following pattern   
 55555  
 45555  
 34555  
 23455  
 12345  */  
 namespace Patterns //18  
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       int i, j, k;  
       for (i = 5; i >= 1; i--)  
       {  
         k = i;  
         for (j = 1; j <= 5; j++)  
         {  
           if (k <= 5)  
           {  
             Console.Write(k);  
           }  
           else  
           {  
             Console.Write("5");  
           }  
           k++;  
         }  
         Console.WriteLine();  
       }        
     }  
   }  
 }  

C# Number Pattern (17)

C# Number Pattern (17)
C# Number Pattern (17)

 /* C# program to print the following pattern   
 1  
 2 4  
 1 3 5  
 2 4 6 8  
 1 3 5 7 9  */  
 namespace Patterns   
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       int i, j, k;  
       for (i = 1; i <= 5; i++)  
       {  
         if (i % 2 == 0)  
         {  
           k = 2;  
         }  
         else  
         {  
           k = 1;  
         }  
         for (j = 1; j <= i; j++, k += 2)  
         {  
           Console.Write(k);  
         }  
         Console.WriteLine();  
       }        
     }  
   }  
 }  

C# Number Pattern (16)

C# Number Pattern (16)
C# Number Pattern (16)

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

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();  
       }        
     }  
   }  
 }  

C# Number Pattern (14)

C# Number Pattern (14)
C# Number Pattern (14)

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

C# Number Pattern (13)

C# Number Pattern (13)
C# Number Pattern (13)
 /* C# program to print the following pattern   
 12345  
 4321  
 123  
 21  
 1  */  
 namespace Patterns   
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       int i, j, k;  
       for (i = 5; i >= 1; i--)  
       {  
         if (i % 2 == 1) k = 1;  
         else k = i;  
         for (j = 1; j <= i; j++)  
         {  
           Console.Write(k);  
           if (i % 2 == 1) k++;  
           else k--;  
         }  
         Console.WriteLine();  
       }        
     }  
   }  
 }  

C# Number Pattern (12)

C# Number Pattern (12)
C# Number Pattern (12)

 /* C# program to print the following pattern   
 11111  
 2222  
 333  
 44  
 5  */  
 namespace Patterns  
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       int i, j;  
       for (i = 1; i &lt;= 5; i++)  
       {  
         for (j = 5; j &gt;= i; j--)  
         {  
           Console.Write(i);  
         }  
         Console.WriteLine();  
       }        
     }  
   }  
 }  

C# Number Pattern (11)

C# Number Pattern (11)
C# Number Pattern (11)

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

2/01/2012

C# Number Pattern (10)

C# Number Pattern (10)
C# Number Pattern (10)

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

C# Number Pattern (9)

C# Number Pattern (9)
C# Number Pattern (9)
 /* C# program to print the following pattern  
 1  
 22  
 333  
 4444  
 55555   */  
 namespace Patterns  
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       int i, j;  
       for (i = 1; i <= 5; i++)  
       {  
         for (j = 1; j <= i; j++)  
         {  
           Console.Write(i);  
         }  
         Console.WriteLine();  
       }        
     }  
   }  
 }  

C# Number Pattern (8)

C# Number Pattern (8)
C# Number Pattern (8)

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

C# Number Pattern (7)

C# Number Pattern (7)
C# Number Pattern (7)

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

C# Number Pattern (6)

C# Number Pattern (6)
C# Number Pattern (6)

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

C# Number Pattern (5)

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

C# Number Pattern (4)

C# Number Pattern (4)
C# Number Pattern (4)

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

C# Number Pattern (3)

C# Number Pattern (3)
C# Number Pattern (3)

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

C# Number Pattern (2)

C# Number Pattern (2)
C# Number Pattern (2)

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

C# Number Pattern (1)

C# Number Pattern (1)
C# Number Pattern (1)

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