Reverse Alphabet Decreasing Triangle in C

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

What You’ll Learn

Print a triangle whose first row is the full reverse run from E to A, then each row drops the leftmost letter: EDCBA, DCBA, CBA, BA, A.

This is the reverse-direction companion to program 6 (which grows from A toward a fixed E on the right). Here both edges march toward A.

⭐ Pattern Output

For five rows from 'E' down to 'A':

Output
EDCBA
DCBA
CBA
BA
A
1

Complete C Program (ASCII Values)

69 is 'E', 65 is 'A'. The inner j loop always ends at 65.

c
#include <stdio.h>

int main() {
    int i, j;

    for (i = 69; i >= 65; --i) {
        for (j = i; j >= 65; --j) {
            printf("%c", j);
        }
        printf("\n");
    }

    return 0;
}

Equivalent with characters: for (i = 'E'; i >= 'A'; --i) and for (j = i; j >= 'A'; --j).

🧠 How It Works

1

Outer loop: high letter

i counts from 69 ('E') down to 65 ('A'). That is the first character on each row.

Start moves left
2

Inner loop: down to A

j runs from i down to 65, printing each code with printf("%c", j).

Fixed low end
3

Row length

When the bottom letter is always 'A' (code 65), row starting at i has i - 65 + 1 characters.

5, 4, 3, 2, 1
4

New line

printf("\n") after the inner loop finishes one row before i decreases again.

Line break
=

Fifteen letters total

For n = 5 rows you print 5+4+3+2+1 = 15 characters — O(n²) for n rows in general.

2

Variation — User Input Version

high = 'A' + rows - 1 is the first row’s leftmost letter (e.g. 'D' for four rows). Loop i from high down to 'A'.

c
#include <stdio.h>

int main() {
    int rows, i, j;
    int high;

    printf("Enter the number of rows: ");
    scanf("%d", &rows);

    high = 'A' + rows - 1;

    for (i = high; i >= 'A'; --i) {
        for (j = i; j >= 'A'; --j) {
            printf("%c", j);
        }
        printf("\n");
    }

    return 0;
}

💡 Tips for Enhancement

Try These

  • Prefer 'E'/'A' bounds over raw numbers when you are not teaching ASCII
  • Lowercase: use 'a' as the floor and 'a' + rows - 1 as the ceiling
  • Compare with program 2 (each row starts at E and runs backward)
  • Validate scanf and keep rows reasonable so 'A' + rows - 1 stays a letter you want

Avoid

  • Mixing up program 6 (count up to E) with this pattern (count down to A)
  • Using ++ on both loops when you need reverse alphabetical order
  • Forgetting that j >= 65 (or >= 'A') must include the final A

Key Takeaways

1

Outer loop lowers the starting letter; inner loop prints down to a fixed 'A'.

2

Descending for loops match descending letters on the screen.

3

Still O(n²) characters for n rows.

4

Mirrors program 6 the same way program 5 mirrors program 1.

❓ Frequently Asked Questions

The outer i picks the leftmost code each line (69, 68, …, 65). For each i, j runs from i down to 65, so the first line is the full descent to A, and later lines start lower.
Program 2 resets the same starting letter each row. Here the start letter itself moves (E, D, C, …), so two nested indices fit the pattern directly.
If the bottom is always 'A' and the row starts at code i, you print i - 'A' + 1 letters (as integers).
O(n²) for n rows.

Explore More C Alphabet Patterns!

Reverse loops are as common as forward loops for interview-style shapes.

All Alphabet Patterns →
Did you know?

The last column is always 'A' because the inner loop always stops there—symmetric to program 6, where the last column was always 'E'.

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