Reverse Repeating-Letter Alphabet Triangle in C#

What You’ll Learn
Same repeating idea as program 9, but letters run E → D → C → B → A while row widths still grow 1, 2, 3, 4, 5.
The simplest trick is to keep the row letter in the outer loop and print it repeatedly inside the inner loop.
⭐ Pattern Output
For 5 rows:
E
DD
CCC
BBBB
AAAAAComplete C# Program
Outer loop selects the row letter (E down to A). Inner loop runs the correct number of times and prints that same row letter.
using System;
namespace MyApp
{
class Program
{
static void Main(string[] args)
{
for (char i = 'E'; i >= 'A'; i--)
{
for (char j = 'E'; j >= i; j--)
{
Console.Write(i);
}
Console.WriteLine();
}
}
}
}🧠 How It Works
Outer loop selects row letter
i runs from 'E' down to 'A'. That is the character printed on the row.
Inner loop controls repeat count
j runs from 'E' down to i, so it executes 1 time for E, 2 times for D, and so on.
Print i, not j
Printing i makes the row uniform (DD, CCC, ...). Printing j would step letters along the row instead.
Same triangle shape as program 9
Total prints are 1+2+…+n for n rows, so time complexity is O(n²).
Variation — User Input Version
Generalize by computing the top letter as 'A' + rows - 1, then count down.
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 = (top - ch) + 1;
for (int k = 1; k <= repeat; k++)
{
Console.Write(ch);
}
Console.WriteLine();
}
}
}
}💡 Tips for Enhancement
Try These
- Compare with Program 9 (same repeats, forward letters)
- Try lowercase by using
'a'and'a' + rows - 1 - Add spaces to create a wider triangle
- Validate input with
int.TryParse
Avoid
- Printing the inner-loop variable if you want rows to repeat the same character
- Letting
rowsexceed 26 without deciding what to do after'Z' - Incrementing the character inside the inner loop (that changes the output)
Key Takeaways
Outer loop chooses the letter for the row (E down to A).
Inner loop only decides how many times to print.
Printing i is what makes each row a repeated-letter row.
Time complexity is O(n²) for n rows.
❓ Frequently Asked Questions
top is the highest letter, you can use ch = (char)(top - (row - 1)).Explore More C# Alphabet Patterns!
Once you understand where to update the character (outer vs inner loop), you can build many variations quickly.
Program 9 and 10 differ only in the outer letter direction: increasing (A to E) vs decreasing (E to A). The inner loop still prints the same letter repeatedly.
12 people found this page helpful
