Reverse Right-Angled Triangle Alphabet Pattern in C#

Beginner
⏱️ 5 min read
📚 Updated: Aug 2025
🎯 2 Code Examples
Nested Loops

What You’ll Learn

How to print a reverse alphabet right-angled triangle in C#: each row has one more character than the previous row, and letters go from 'E' down to 'A' (for five rows) using nested for loops.

The output is E, ED, EDC, EDCB, EDCBA—same geometry as program 1, but descending along the alphabet on each row.

⭐ Pattern Output

For 5 rows:

Output
E
ED
EDC
EDCB
EDCBA
1

Complete C# Program

Fixed five rows: outer loop sets the last letter for each row (E, D, C, B, A) and the inner loop prints from 'E' down to that letter.

C#
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(j);
                }
                Console.WriteLine();
            }
        }
    }
}

🧠 How It Works

1

Outer loop (rows)

The outer loop runs i from 'E' down to 'A'. Each value represents the last letter printed on that row.

Row control
2

Inner loop (descending letters)

For each row, the inner loop starts at 'E' and prints down to i using Console.Write(j). That yields E, then ED, then EDC, and so on.

Print letters
3

New line

Console.WriteLine() ends the current row and moves to the next line.

Next row
=

Reverse letter triangle

You print 1+2+…+n letters in total, so time complexity is O(n²) for n rows.

2

Variation — User Input Version

Read the number of rows and compute the top letter as 'A' + rows - 1:

C#
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 i = top; i >= 'A'; i--)
            {
                for (char j = top; j >= i; j--)
                {
                    Console.Write(j);
                }
                Console.WriteLine();
            }
        }
    }
}

💡 Tips for Enhancement

Try These

  • Use int.TryParse to validate input before computing top
  • Print lowercase by using 'a' as the base instead of 'A'
  • Add spaces between letters for readability
  • Compare with Program 1 for the forward triangle

Avoid

  • Forgetting that the pattern uses j >= i with j-- for descending output
  • Letting rows exceed 26 without handling letters beyond 'Z'
  • Skipping Console.WriteLine() after each row

Key Takeaways

1

Row k prints k letters, and letters run from the top letter down to a row-specific end letter.

2

Use top = (char)('A' + rows - 1) to generalize the pattern for any row count.

3

Complexity is O(n²) for n rows.

4

This is a mirror of Program 1: only the letter direction changes.

❓ Frequently Asked Questions

Because the inner loop always starts at top (E in the fixed example). Only the end letter changes with the outer-loop bound, so the triangle grows by one character each row.
Use Program 1: loop upward from 'A' and print to the current end letter.
O(n²) for n rows because you print 1+2+…+n characters.

Explore More C# Alphabet Patterns!

Reverse and mixed letter patterns are great practice for loop bounds and character arithmetic.

All Alphabet Patterns →
Did you know?

In C#, decrementing a char works naturally: 'E' - 1 becomes 'D'. That’s why counting down with j-- prints letters in reverse order.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful