down Triangle Patterns in C#

Downward Triangle Pattern in C#

In this category, we just get a mirrored triangle of the first triangle pattern. You can also make changes in the second category to get a mirror triangle pattern of that.

But the following is the code for only the first cat of the triangle mirror.

Sample Code:

using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Text;  
namespace DownwardPattern
{  
   class Program  
   {  
      static void Main(string[] args)  
      {  
         int val = 5;  
         int i, j, k ;  
         for (i = 1; i <= val; i++)  
         {  
            for (j = 1; j <= val-i; j++)  
            {  
               // Console.Write(" ");  
            }  
            for (k = 1; k <= j; k++)  
            {  
               Console.Write("*");  
            }  
            Console.WriteLine("");  
         }  
         Console.ReadLine();  
      }  
   }  
}  

Leave a Reply

Your email address will not be published. Required fields are marked *