C Reverse Alphabet Triangle Pattern (Decreasing)

Beginner
6 min read
Updated: Sep 2026
3 programs
Live preview

What Is This Pattern?

A reverse alphabet decreasing triangle prints shrinking reverse runs that always end at A — each row drops the leftmost letter from the row above.

Remember
Rule: start letter i walks top..A; print j from i..A

EDCBA
DCBA
CBA
BA
A     ← 5 rows (top = E)

Unlike Program 8 (always starts at E and shortens the tail), here the first letter moves: E, then D, then C… while every row still ends on A.

How to Solve It

Both loops run backward: the outer picks the row start, the inner prints from that start down to A.

MethodIdeaBest for
Char countdownOuter i from top..A; inner j from i..ALearning, interviews, fixed demos
Row counttop = 'A' + rows - 1, then same loopsUser input for height

Pseudocode

Pseudocode
top = 'A' + rows - 1
for i from top down to 'A':
    for j from i down to 'A':
        print j (no newline)
    print newline

Cheat sheet

GoalPattern
Pick the row startfor (char i = top; i >= 'A'; i--)
Print i..Afor (char j = i; j >= 'A'; j--) printf("%c", j);
Compute top from rowstop = (char)('A' + rows - 1);
Spaced lettersprintf("%c ", j);
End the rowprintf("\n");
A–Z-safe heightClamp rows to 1–26

Printing Letters vs Starting a New Line

APIEffectUse for
printf("%c", j)Stays on the same lineEach letter on the row
printf("\n")Ends the current lineAfter the inner loop

Print characters without a newline, then end the row once.

Live Preview

Change the row count and the reverse decreasing triangle updates instantly — including top letter and letter totals.

Whole numbers from 1 to 10. Top letter is A + rows - 1; total letters equal n(n+1)/2.

Live result 5 rows · top E · 15 letters
EDCBA
DCBA
CBA
BA
A

Worked Walkthrough — top = 'E'

Trace each start letter i and the reverse run printed from i down to A.

iInner jPrinted rowCount
EE..AEDCBA5
DD..ADCBA4
CC..ACBA3
BB..ABA2
AA..AA1

Total letters: 5 + 4 + 3 + 2 + 1 = 15 = n(n+1)/2. Every row ends on A because the inner loop always stops there.

C Programs

Three complete programs: fixed top E, row-count input, and spaced letters. Use View Output to reveal sample results.

Example 1 — Fixed Top E

Outer loop chooses the starting letter (E down to A). Inner loop prints from that start down to A.

C
#include <stdio.h>

int main() {
    char i, j;

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

    return 0;
}

How It Works

1. Outer loop picks the start. i walks E, D, C, B, A — the first letter on each row.

2. Inner loop prints down to A. From i down to 'A'. When i = 'C', that is CBA.

3. Break the line. printf("\n") after the inner loop starts the next shorter reverse run.

Example 2 — Row Count Input

Read the number of rows and compute top = 'A' + rows - 1. Check scanf in real apps.

C
#include <stdio.h>

int main() {
    int rows;
    char top, i, j;

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

    top = (char)('A' + rows - 1);
    for (i = top; i >= 'A'; i--) {
        for (j = i; j >= 'A'; j--) {
            printf("%c", j);
        }
        printf("\n");
    }

    return 0;
}

How It Works

1. Map rows → top. For 4 rows, top becomes 'D'.

2. Same nested-loop core. Only the bounds follow top instead of the literal 'E'.

3. Safer input tip. Check scanf and stay within A–Z:

Safer input
if (scanf("%d", &rows) != 1 || rows < 1 || rows > 26) {
    printf("Enter a row count from 1 to 26.\n");
    return 1;
}

Example 3 — Spaced Letters

Print a trailing space after each letter so columns are easier to scan.

C
#include <stdio.h>

int main() {
    char top = 'E';
    char i, j;

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

    return 0;
}

How It Works

1. Same bounds. Outer and inner loops match Example 1 — only the printed unit changes.

2. Letter plus space. printf("%c ", j) makes columns easier to read at a glance.

3. Compact tip. Trim trailing spaces later if you need a tight line without a final space.

Edge Cases & Pitfalls

Check these before calling the solution done.

j from top

Wrong pattern

Starting the inner loop at top every row (instead of i) prints Program 8 style — always beginning with E.

Ascending j

Forward letters

Counting j upward prints ABCDE-style suffixes. Keep j descending from i to A.

Missing \\n

One long line

Call printf("\n") after each inner loop. Without it, every letter lands on one line.

rows = 1

Single A

Output is just A — a good sanity check.

Past Z

Clamp to 26

More than 26 rows walks top past Z. Cap or reject the input.

scanf fail

Unchecked input

Always check scanf("%d", &rows) == 1 so bad input does not leave rows uninitialized.

Time and Space Complexity

ProgramTimeExtra space
Fixed / input / spaced formsO(n²)O(1)

Total letters printed = n + (n-1) + … + 1 = n(n+1)/2, which is quadratic in the number of rows.

Key Takeaways

  • Both loops decrement: start letter walks top..A; each row prints i..A.
  • Right edge is A: every row ends at A while the left side walks backward.
  • Vs Program 8: start letter changes each row; it does not stay fixed at E.
  • Complexity: O(n²) time; O(1) extra space.

One line: for each start letter counting down, print start..A, then printf("\n").

Frequently Asked Questions

The outer loop picks the starting letter (E, then D, then C…). The inner loop prints from that start down to A, so the first line is EDCBA and each next line drops the previous leftmost letter.
The outer loop decreases the starting letter each row, and the inner loop decreases letters within that row down to A. That matches the reverse-alphabet output.
Program 6 prints forward suffixes ending at E (ABCDE, BCDE, …). This pattern prints reverse runs ending at A (EDCBA, DCBA, …). Same shrinking widths; opposite letter direction.
Program 8 always starts each row at E and shortens the tail (EDCBA, EDCB, EDC). Program 7 changes the first letter each row (E, then D, then C…).
Because the inner loop condition includes j == 'A', so the final character printed on each row is always A.
O(n²) for n rows, because total printed characters are n(n+1)/2.
Yes. Read rows with scanf, set top = (char)('A' + rows - 1), then loop i from top down to 'A' and print j from i down to 'A'.
Check scanf("%d", &rows) == 1, require n ≥ 1, and cap at 26 so the top letter stays within A–Z.

Did you know?

This triangle prints reverse letters and shrinks each row: EDCBA, DCBA, CBA, BA, A. Both loops run backward so letters move toward 'A' on every line.

Next: Reverse Fixed Start

Always begin at E and shorten the reverse tail each row.

Program 8 tutorial →

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