C# Program to print Alphabet Triangle
In this C# program, we will take input (Number of rows) from the user and print the alphabet triangle based on the number of rows input by the user.
C# Program to print Alphabet Triangle Code:
private static void Main(string[] args)
{
char ch = 'A';
int i, j, k, m, n;
Console.Write("Enter the number of rows:");
n = int.Parse(Console.ReadLine());
for (i = 1; i <= n; i++)
{
for (j = n; 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';
}
Console.ReadLine();
}
C# Program to print Alphabet Triangle Output: