Inverted Forward Repeating Alphabet Triangle in C#

What You’ll Learn
Row width shrinks from five to one, but the letter moves forward each row: AAAAA, BBBB, CCC, DD, E.
Compare program 11 (same shape, letters step down from E) and program 9 (width grows with forward letters).
⭐ Pattern Output
For 5 rows:
AAAAA
BBBB
CCC
DD
EComplete C# Program
Outer loop selects the row letter (A up to E). Inner loop counts down from E 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 = 'A'; i <= 'E'; i++)
{
for (char j = 'E'; j >= i; j--)
{
Console.Write(i);
}
Console.WriteLine();
}
}
}
}🧠 How It Works
Outer loop: choose the letter
i runs from 'A' to 'E'. That becomes the row character.
Inner loop: control the width
j runs from 'E' down to i. That gives 5 iterations for A, 4 for B, ... 1 for E.
Print the row letter
Inside the inner loop, print i to keep the row uniform: AAAAA, then BBBB, 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 while letters go forward.
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 (int row = 0; row < rows; row++)
{
char ch = (char)('A' + row);
int repeat = rows - row;
for (int k = 1; k <= repeat; k++)
{
Console.Write(ch);
}
Console.WriteLine();
}
}
}
}💡 Tips for Enhancement
Try These
- Compare with Program 11 (same inverted shape, letters step down)
- 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
Row widths shrink from 5 to 1 (inverted triangle).
Letters move forward from A to E.
Print the outer-loop letter to repeat the row character.
Complexity is O(n²) for n rows.
❓ Frequently Asked Questions
EEEEE, DDDD, ... (letters step down). Program 12 prints AAAAA, BBBB, ... (letters step up) with the same inverted widths.i. As i increases, the loop has fewer iterations.Explore More C# Alphabet Patterns!
Inverted patterns often come from flipping which variable sets the inner loop limit.
This pattern is the forward-letter counterpart of program 11: same inverted triangle widths, but the letter direction is A→E instead of E→A.
12 people found this page helpful
