C# Program To Print Alphabet Triangle - C# Tutorial
C# Course / Programs / C# Program To Print Alphabet Triangle

C# Program To Print Alphabet Triangle

BLUF: Mastering C# Program To Print Alphabet Triangle is essential for building robust applications with the .NET ecosystem. This tutorial provides clear explanations and practical examples to help you understand and apply this C# concept.
Enterprise Development Tip: C# Program To Print Alphabet Triangle

C# is a powerful, modern language for enterprise solutions. Discover how C# Program To Print Alphabet Triangle enhances your development workflow in the guide below.

There are various types of triangles that can be displayed. Triangles can be produced using letters or digits. In this C# script, we will be generating triangles using alphabets.

Let's explore an example in C# to generate a triangle of alphabets.

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:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience