Inverted Repeating-Letter Alphabet Triangle in C#

What You’ll Learn
First row: five Es. Each following row is one character shorter and uses the next letter down: EEEEE, DDDD, CCC, BB, A.
Compare with program 10 (width grows 1..5 while letters go E→A) and program 9 (width grows and letters go A→E).
⭐ Pattern Output
For 5 rows:
EEEEE
DDDD
CCC
BB
AComplete C# Program
Outer loop selects the row letter (E down to A). Inner loop runs from A up to that letter, which produces widths 5..1 while printing the same row letter.
using System;
namespace MyApp
{
class Program
{
static void Main(string[] args)
{
for (char i = 'E'; i >= 'A'; i--)
{
for (char j = 'A'; j <= i; j++)
{
Console.Write(i);
}
Console.WriteLine();
}
}
}
}🧠 How It Works
Outer loop: choose the letter
i runs from 'E' down to 'A'. That becomes the row character.
Inner loop: control the width
j runs from 'A' to i. That gives 5 iterations for E, 4 for D, ... 1 for A.
Print the row letter
Inside the inner loop, print i to keep the row uniform: EEEEE, then DDDD, and so on.
Total work
You still print 5+4+3+2+1 characters for 5 rows. In general, it is \(n(n+1)/2\) so complexity is O(n²).
Variation — User Input Version
Generalize by choosing the top letter as 'A' + rows - 1, then print widths from rows down to 1.
using System;
namespace MyApp
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter the number of rows: ");
int rows = Convert.ToInt32(Console.ReadLine());
char top = (char)('A' + rows - 1);
for (char ch = top; ch >= 'A'; ch--)
{
int repeat = ch - 'A' + 1;
for (int k = 1; k <= repeat; k++)
{
Console.Write(ch);
}
Console.WriteLine();
}
}
}
}💡 Tips for Enhancement
Try These
- Compare with Program 10 (same letters, width grows instead of shrinking)
- Use lowercase by switching to
'a'and'a' + rows - 1 - Add a space after each character if you want a wider shape
- Validate input with
int.TryParse
Avoid
- Printing the inner-loop variable if you want repeating letters
- Letting
rowsexceed 26 without handling letters beyond'Z' - Changing the letter inside the inner loop (that creates different patterns)
Key Takeaways
First row is widest and repeats the top letter.
Each next row is shorter and uses the next letter down.
Print the outer-loop letter inside the inner loop for repeats.
Complexity is O(n²) for n rows.
❓ Frequently Asked Questions
j <= i. Smaller i means fewer iterations, so fewer characters are printed.Explore More C# Alphabet Patterns!
Inverted patterns usually come from flipping loop bounds (count down instead of up, or stop earlier).
This is the inverted version of the repeating-letter idea: instead of growing from 1 to 5, the row widths shrink from 5 to 1, while the row letter steps downward.
12 people found this page helpful
