Monday, April 18, 2016

Triangle Patterns in c#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication7
{
    class Program
    {
        static void Main(string[] args)
        {

            int v1 = 6;
            int i, j, k;
            for (i = 1; i <= v1; i++)
            {
                for (j = 1; j <= v1 - i; j++)
                {
                  
                }
                for (k = 1; k <= i; k++)
                {
                    Console.Write("*");
                }
                Console.WriteLine("");
            }
            Console.ReadLine();
        }
    }
}

Output :

No comments:

Post a Comment