Tuesday 21 February 2017

print traingle shape characters in c#

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

namespace ConsoleApplication29
{
    class Program
    {
        static void Main(string[] args)
        {
            char ch = 'A';
            for (int i = 1; i < 5; i++)
            {
                for(int j=1;j<=i;j++)
                {
                    Console.Write(ch + " ");
                    ch++;

                }
                Console.WriteLine();
            }
        }
    }

}

output screenshot:



No comments:

Post a Comment