Reverse Triangle, E Always First in C

Beginner
⏱️ 8 min read
📚 Updated: Aug 2026
🎯 3 Code Examples
🚀 Live Preview
Nested Loops

What You’ll Learn

Print a reverse triangle where every row begins with the same top letter (E in the 5-row example) and becomes shorter each line: EDCBA, EDCB, EDC, ED, E. Compare Program 7 (the first letter changes each row) and Program 5 (forward prefixes from A). Includes a live preview, worked C examples, edge cases, and complexity.

Shape Rule

Fixed left

Every row starts at E; the right edge moves left.

Outer Loop

i++ floor

Raises the stop letter A → E to shorten tails.

Inner Loop

top..i

Always starts at top; counts down to the floor.

vs Program 7

Same widths

Both shrink 5…1; this one keeps E on the left.

Live Preview

Rows 1–10

Pick a row count and draw EDCBA…E live.

O(n²)

Complexity

n+(n-1)+…+1 printed characters total.

Introduction

A fixed-start reverse alphabet triangle keeps a vertical left edge at the top letter while each row clips one more character from the right.

In C you raise a floor with the outer loop (i++) and always print from top down to that floor with the inner loop.

Why it matters?

It pairs with Program 7 to show two reverse shrinking styles: move the start, or keep the start fixed and raise the stop — same widths, different edges.

Key Highlights

Outer

i from A to top.

Inner

j from top down to i.

Edge

Every row starts at top.

Output

EDCBA … E

In short: for each floor letter i from 'A' to top, print j from top down to i, then call printf("\n").

📝 Problem & Approach

Given a row count (or fixed top E), print a shrinking reverse triangle where every row begins at the same top letter.

c
// Five rows (top = E)
// EDCBA
// EDCB
// EDC
// ED
// E

Inputs & Outputs

ItemTypeDescription
rows / topint / charNumber of rows; top letter is 'A' + rows - 1 (E for 5).
Printed outputtextShrinking reverse prefixes from top..A down to top alone.

Minimal workflow

Pseudocode
top = 'A' + rows - 1
for i from 'A' to top:          // raise the floor
    for j from top down to i:   // reverse from fixed start
        print j
    print newline

Approach comparison

ApproachIdeaBest for
Char nested loopsOuter i++, inner j-- from top to iMatching this classic sample
Clip from the rightThink of each row as a shorter reverse prefix of EDCBAWhen explaining tails conceptually

⚡ Quick Reference

GoalPattern
Fixed A–Efor (char i = 'A'; i <= 'E'; i++)
Fixed start reversefor (char j = 'E'; j >= i; j--) printf("%c", j);
User rowschar top = (char)('A' + rows - 1); then j from top down to i
Moving start insteadSee Program 7 (j from i down to A)
Forward fixed leftSee Program 5 (A..i shrink)

📋 Prog 5 vs Prog 7 vs Prog 8

Three shrinking triangles — different fixed edges and letter directions.

Program 5
A..i shrink

ABCDE, ABCD — left fixed at A

Program 7
i..A shrink

EDCBA, DCBA — right fixed at A

Program 8
top..i shrink

EDCBA, EDCB — left fixed at top

printf("\n")
break

Ends the row after top..i finishes

Context

When This Pattern Shows Up

Reach for this when teaching a fixed reverse start with a rising stop bound.

  1. After Program 7

    Keep reverse letters; pin the first character and clip the tail.

  2. Fixed left-edge drills

    Practice reverse prefixes that always begin at the same letter.

  3. Bridge to Program 9

    Next switches to repeating letters: A, BB, CCC, …

  4. Mixed-direction practice

    Mix i++ with j-- in the same program.

  5. Not a UI layout tool

    This is a console teaching pattern — not how you build modern app screens.

Key benefit: one fixed reverse start plus a rising floor is the cleanest way to shrink a reverse triangle while keeping a vertical left edge.

🔮 Live Preview

Choose 1–10 rows and draw the fixed-start reverse alphabet triangle in the browser.

Try 5 (classic EDCBA…E) or 4 (DCBA…D). Max 10 keeps the preview readable.

Live result
Press "Draw pattern".

Examples Gallery

Three complete C programs — fixed A–E, scanf row count, and a spaced-letter variant. Click View Output to reveal sample console results.

📚 Getting Started

Print five shrinking reverse rows that always start at E.

Example 1 — Fixed Top E

Outer loop raises the stopping letter; inner loop always starts at E and counts down.

c
#include <stdio.h>

int main() {
    char i, j;

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

    return 0;
}

How It Works

When i = 'C', the inner loop prints E, D, CEDC. When i = 'E', it prints only E.

📈 Practical Variant

Let the user choose how many rows to print.

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 = 'A'; i <= top; i++) {
        for (j = top; j >= i; j--) {
            printf("%c", j);
        }
        printf("\n");
    }

    return 0;
}

How It Works

For 4 rows, top becomes 'D'. Cap rows at 26 so top stays within A–Z.

⚡ Readability Variant

Same triangle with spaces between letters.

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 = 'A'; i <= top; i++) {
        for (j = top; j >= i; j--) {
            printf("%c ", j);
        }
        printf("\n");
    }

    return 0;
}

How It Works

Loop bounds are unchanged — only the printed unit becomes j + " ". Trim trailing spaces later if you need a compact line.

🧠 How the Algorithm Prints Rows

1

Outer loop raises the floor

i runs from 'A' to top. It sets how far down the inner loop should go on that row.

Lower bound
2

Inner loop always starts at top

j starts at top on every row, so the first printed character is always that letter (E for five rows).

Fixed first letter
3

Shrinking tail

The condition j >= i makes the row shorter each time: when i is A, you print down to A; when i is E, you print only E.

5 … 1
4

Left edge stays fixed

Because the inner loop always starts at top, every row begins on the same letter while the right edge moves left.

Alignment
=

Mixed directions

Outer i++ and inner j-- together control the clipping. Total work is still O(n²).

🔎 Worked Walkthrough — Top = E (5 rows)

Trace each floor letter and the resulting reverse prefix from E.

i (floor)Inner rangePrinted row
AE..AEDCBA
BE..BEDCB
CE..CEDC
DE..DED
EE..EE

Row lengths are 5, 4, 3, 2, 1. The left edge is always E.

Use Cases

Where this fixed-start reverse alphabet triangle shows up beyond the homework prompt.

1. Clip Labs

Clearest demo of raising only the stop bound.

Example: start j at i instead and compare with Program 7.

2. Edge Practice

Fixed left edge with a moving right edge.

Example: stack next to Program 5’s fixed A edge.

3. Mixed Bounds

Practice inclusive ranges from a fixed top down to a rising floor.

Example: off-by-one if you stop before i.

4. Input Scaling

Map row count to top letter with 'A' + rows - 1.

Example: scale from 5 to 8 without rewriting loops.

5. Complexity Intuition

Triangle sums make O(n²) easy to see.

Example: 15 letters for 5 rows.

6. Series Continuity

Sits between Programs 7 and 9 in the alphabet set.

Example: revisit Program 2.

Pro Tip: say “always start at top, raise the floor” before coding — that story prevents starting at i by habit.

Advantages

Why this pattern earns a spot early in the alphabet-pattern series.

  1. 1. Instant Visual Feedback

    A moving first letter or full-width rows show up immediately.

  2. 2. Clear Pair with Program 7

    Same reverse shrinking; only which edge stays fixed differs.

  3. 3. Scales Cleanly

    Change the top letter or row count and the whole triangle clips from the right.

  4. 4. Beginner-Friendly

    No padding or diagonal checks — just two char loops.

Pro Tip: master Program 7 first; this page is mostly “same reverse idea, always start at top and raise the floor.”

Usage Tips

Small habits that keep fixed-start reverse alphabet triangles clean.

  1. 1. Always Start the Inner Loop at Top

    Starting at i turns this into Program 7.

  2. 2. Stop at i, Not Always at A

    Using j >= 'A' prints full width every row.

  3. 3. Set top = 'A' + rows - 1

    Forgetting the - 1 makes the first row one letter too long.

  4. 4. Cap Rows at 26

    Keep the top letter inside A–Z when taking user input.

  5. 5. Check scanf

    Validate the row count and check scanf’s return value.

Pro Tip: if you see EDCBA, DCBA, CBA, the inner loop is starting at i — switch to start at top.

Common Pitfalls

Mistakes that commonly break fixed-start reverse alphabet triangles.

  1. 1. Starting the Inner Loop at i

    Prints Program 7 instead of EDCBA, EDCB, …

    → Use for (char j = top; j >= i; j--).

  2. 2. Stopping at A Every Row

    Using j >= 'A' prints full EDCBA each time.

    → Keep the condition j >= i.

  3. 3. Wrong top Formula

    Using 'A' + rows without - 1 overshoots.

    → Use top = (char)('A' + rows - 1).

  4. 4. Unchecked scanf

    Empty or non-numeric input leaves rows unused or uninitialized.

    → Check scanf’s return value and validate range.

  5. 5. Forgetting printf("\n")

    All letters dump onto one line.

    → Call printf("\n") after each inner loop.

Edge Cases

Check these inputs before calling the solution done.

rows = 1

Single letter

Output is just A.

rows = 5

Classic sample

EDCBA down to E (Example 1).

rows = 4

Smaller triangle

DCBA down to D (Example 2).

rows > 26

Past Z

Cap or reject — top leaves the alphabet.

Bad input

Empty / non-numeric

Check scanf’s return value.

Lowercase

edcba … e

Swap 'A' for 'a' in both loops.

🎯 Practice Problems

Try these variations to lock in the pattern.

1. Flip to Program 7

  • Start the inner loop at i
  • Confirm you get EDCBA, DCBA, CBA

2. Compare with Program 5

  • Note fixed left edge with forward vs reverse letters
  • See Program 5

3. Scale to 8 rows

  • Use the input version
  • Check the first row is HGFEDCBA

4. Break the shrink on purpose

  • Change to j >= 'A' once
  • Confirm every row becomes full width

Notes

  • Floor rises. Outer i++ shortens each row from the right.
  • The inner loop always starts at top, so the left edge is vertical.
  • Row lengths are n, n-1, …, 1 — same as Program 7, fixed left edge.
  • Next up: Alphabet Pattern 9 switches to repeating letters.

Quick Takeaway: always start at the top letter, then raise the floor with the outer loop — that alone builds EDCBA, EDCB, …, E.

⏱️ Time and Space Complexity

ProgramTimeExtra space
Inline / input (Examples 1–2)O(n²)O(1)
Spaced letters (Example 3)O(n²)O(1)

For n rows you print n+(n-1)+…+1 = n(n+1)/2 characters, so total work is O(n²).

Wrap Up

🎉 Conclusion

The fixed-start reverse alphabet triangle keeps a vertical left edge at the top letter while the floor rises A…E to clip the tail. Master the classic EDCBA…E sample, then try user input and the spaced rewrite.

Practice the three examples above, then continue to Alphabet Pattern 9.

Outer i from A to top, inner j from top down to i, then break each line.

💡 Best Practices

✅ Do

  • Start the inner loop at top every row
  • Stop the inner loop at i (not always at A)
  • Use top = 'A' + rows - 1 for input versions
  • Cap user row counts at 26
  • State O(n²) when asked about complexity

❌ Don’t

  • Start the inner loop at i (that becomes Program 7)
  • Use j >= 'A' when you want shrinking rows
  • Forget the - 1 in the top formula
  • Skip validating row-count input
  • Call printf("\n") inside the letter loop

Key Takeaways

Knowledge Unlocked

Five things to remember about this alphabet pattern

Print the fixed-start reverse alphabet triangle the beginner-friendly way.

5
Core concepts
= 02

Inner

j from top to i

Code
1 03

Edge

Every row starts at top

Shape
R 04

vs Prog 7

Same widths, left fixed

Compare
O 05

Complexity

O(n²) time

Analysis

❓ Frequently Asked Questions

Because the inner loop always starts at the top letter (E in the 5-row example) and counts down. So the first printed character each row is always E.
The outer loop increases the stopping point for the inner loop. That shortens the tail each row, producing EDCBA, then EDCB, then EDC, and so on.
Program 7 changes the first letter each row (E, then D, then C…). Program 8 keeps the first letter fixed and only shortens the tail.
Program 5 prints forward prefixes from A (ABCDE, ABCD, …). This pattern prints reverse prefixes from a fixed top (EDCBA, EDCB, …). Same shrinking idea; opposite letter direction and left edge.
Every row would print the full reverse run (EDCBA each time) with no shrinking.
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 'A' to top and print j from top down to i.
Check scanf("%d", &rows) == 1, require n ≥ 1, and cap at 26 so the top letter stays within A–Z.

Did you Know? 🔊

Every row begins with 'E' (in the 5-row example) because the inner loop always starts from that top letter. The outer loop only increases the stopping point, so the tail gets shorter: EDCBA, EDCB, EDC, ED, E.

Explore More C Alphabet Patterns!

Fixing one corner and sliding loop bounds is a great way to invent new patterns.

All Alphabet Patterns →

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