C# Program To Print Alphabet Triangle

There are different triangles that can be printed. Triangles can be generated by alphabets or numbers. In this C# program, we are going to print alphabet triangles.

Let's see the C# example to print alphabet triangle.

Example

Example

using System;

  public class PrintExample

   {

     public static void Main(string[] args)

      {

       char ch='A';    

       int i, j, k, m;    

       for(i=1; i<=5; i++)    

       {    

        for(j=5; j>=i; j--)    

         Console.Write(" ");    

        for(k=1;k<=i;k++)    

         Console.Write(ch++);    

        ch--;    

        for(m=1;m<i;m++)    

         Console.Write(--ch);    

        Console.Write("\n");    

        ch='A';    

       }    

   }

  }

Output:

Output

A

    ABA

   ABCBA

  ABCDCBA

 ABCDEDCBA

Input Required

This code uses input(). Please provide values below: