Shape Rule
Rows shrink
First row longest; each next row loses one letter.

Print an inverted alphabet right-angled triangle: the first row is the longest (ABCDE for five rows), and each next row removes one letter while still starting from 'A'. This is the partner to Program 1 — only the outer loop direction changes. Compare also with Program 4. Includes a live preview, worked C examples, edge cases, and complexity.
Rows shrink
First row longest; each next row loses one letter.
i-- from top
End letter moves E → A to shrink width.
A..i
Same forward prefix as Program 1 every row.
Invert
Flip only the outer loop to grow instead of shrink.
Rows 1–10
Pick a row count and draw ABCDE…A live.
Complexity
n+(n-1)+…+1 printed characters total.
An inverted alphabet triangle is Program 1 turned upside down: start with the full prefix, then drop one letter from the end on each following row.
In C you count the outer bound down (i--) while the inner loop still prints from 'A' up to i.
It shows that growing vs shrinking triangles are often the same inner loop with opposite outer bounds — a key nested-loop insight.
i from top down to A.
j from A up to i.
Every row starts at A.
ABCDE … A
In short: for each end letter i from top down to 'A', print j from 'A' up to i, then call printf("\n").
Given a row count (or fixed top E), print an inverted right-angled triangle where each row is an A-prefix that gets shorter.
// Five rows (top = E)
// ABCDE
// ABCD
// ABC
// AB
// A | Item | Type | Description |
|---|---|---|
rows / top | int / char | Number of rows; top letter is 'A' + rows - 1 (E for 5). |
| Printed output | text | Shrinking forward prefixes from A..top down to A. |
top = 'A' + rows - 1
for i from top down to 'A': // end letter shrinks
for j from 'A' to i: // forward prefix each row
print j
print newline | Approach | Idea | Best for |
|---|---|---|
| Char nested loops | Outer i--, inner j++ from A to i | Matching this classic sample |
| Row index + length | For r = n..1 print first r letters of the alphabet | When thinking in lengths instead of end letters |
Same alphabet prefixes — different growth and letter direction.
grow A..iA, AB, ABC — outer i++
grow i..AA, BA, CBA — reverse along row
shrink A..iABCDE, ABCD, A — outer i--
breakEnds the row after A..i finishes
Reach for this when teaching a shrinking end bound with a forward A-prefix each row.
Keep the same inner loop; flip only the outer direction.
Same geometry as inverted star triangles, with letters.
Next shrinks from the left instead: ABCDE, BCDE, CDE, …
Mix i-- with j++ in the same program.
This is a console teaching pattern — not how you build modern app screens.
Key benefit: one descending outer bound plus Program 1’s inner loop is the cleanest way to invert a growing alphabet triangle.
Choose 1–10 rows and draw the inverted alphabet triangle in the browser.
Three complete C programs — fixed A–E, scanf row count, and a spaced-letter variant. Click View Output to reveal sample console results.
Print five shrinking rows that always start at A.
EOuter loop shrinks the row by decreasing the end letter from 'E' to 'A'. Inner loop always prints from 'A' up to that end letter.
#include <stdio.h>
int main() {
char i, j;
for (i = 'E'; i >= 'A'; i--) {
for (j = 'A'; j <= i; j++) {
printf("%c", j);
}
printf("\n");
}
return 0;
} When i = 'C', the inner loop prints A, B, C → ABC. When i = 'A', it prints only A.
Let the user choose how many rows to print.
Read the number of rows and compute top = 'A' + rows - 1. Check scanf in real apps.
#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 = 'A'; j <= i; j++) {
printf("%c", j);
}
printf("\n");
}
return 0;
} For 4 rows, top becomes 'D'. Cap rows at 26 so top stays within A–Z.
Same triangle with spaces between letters.
Print a trailing space after each letter so columns are easier to scan.
#include <stdio.h>
int main() {
char top = 'E';
char i, j;
for (i = top; i >= 'A'; i--) {
for (j = 'A'; j <= i; j++) {
printf("%c ", j);
}
printf("\n");
}
return 0;
} Loop bounds are unchanged — only the printed unit becomes j + " ". Trim trailing spaces later if you need a compact line.
i runs from top down to 'A'. That means the first row has the most letters and each next row has one fewer.
For each row, j starts at 'A' and goes up to i, so every row begins with A.
printf("\n") ends the row before the next (shorter) row prints.
Because the inner loop always starts at 'A', every row begins on A while the right edge moves left.
Total printed characters are still n+(n-1)+…+1, so time complexity is O(n²).
Trace each end letter and the resulting forward prefix from A.
i (end) | Inner range | Printed row |
|---|---|---|
E | A..E | ABCDE |
D | A..D | ABCD |
C | A..C | ABC |
B | A..B | AB |
A | A..A | A |
Row lengths are 5, 4, 3, 2, 1. The left edge is always A.
Where this inverted alphabet triangle shows up beyond the homework prompt.
Clearest demo of flipping only the outer loop.
Example: change i-- to i++ and compare with Program 1.
Fixed left edge (A) with a moving right edge.
Example: stack next to Program 6’s moving left edge.
Practice inclusive descending outer ranges ending at 'A'.
Example: off-by-one if you stop at 'B'.
Map row count to top letter with 'A' + rows - 1.
Example: scale from 5 to 8 without rewriting loops.
Triangle sums make O(n²) easy to see.
Example: 15 letters for 5 rows.
Sits between Programs 4 and 6 in the alphabet set.
Example: revisit Program 1.
Pro Tip: say “start at the full prefix, then shorten the end letter” before coding — that story prevents writing a growing outer loop by habit.
Why this pattern earns a spot early in the alphabet-pattern series.
A growing triangle or missing A shows up immediately.
Only the outer step direction changes.
Change the top letter or row count and the whole triangle shrinks from there.
No padding or diagonal checks — just two char loops.
Pro Tip: master Program 1 first; this page is mostly “same inner loop, count the outer bound down.”
Small habits that keep inverted alphabet triangles clean.
Use i >= 'A' so the last row still prints A.
Starting at a moving letter turns this into Program 6 instead.
Forgetting the - 1 makes the first row one letter too long.
Keep the top letter inside A–Z when taking user input.
scanfValidate the row count and check scanf’s return value.
Pro Tip: if you see A, AB, ABC, the outer loop is still incrementing — switch to i-- from top.
Mistakes that commonly break inverted alphabet triangles.
Prints Program 1 instead of ABCDE, ABCD, …
→ Use for (char i = top; i >= 'A'; i--).
Produces Program 6-style suffixes (BCDE, CDE, …).
→ Always start at j = 'A'.
Using 'A' + rows without - 1 overshoots.
→ Use top = (char)('A' + rows - 1).
scanfEmpty or non-numeric input leaves rows unused or uninitialized.
→ Check scanf’s return value and validate range.
printf("\n")All letters dump onto one line.
→ Call printf("\n") after each inner loop.
Check these inputs before calling the solution done.
Output is just A.
ABCDE down to A (Example 1).
ABCD down to A (Example 2).
Cap or reject — top leaves the alphabet.
Check scanf’s return value.
Swap 'A' for 'a' in both loops.
Try these variations to lock in the pattern.
i++i instead of 'A'i-- shortens each row from the right.'A', so the left edge is vertical.Quick Takeaway: shrink the end letter with the outer loop, then print from A up to that bound — that alone builds ABCDE, ABCD, …, A.
| Program | Time | Extra 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²).
The inverted alphabet triangle is Program 1 with a descending outer loop: the end letter shrinks E…A while each row still prints forward from A. Master the classic ABCDE…A sample, then try user input and the spaced rewrite.
Practice the three examples above, then continue to Alphabet Pattern 6.
Outer i from top down to A, inner j from A up to i, then break each line.
top and count down to 'A''A'top = 'A' + rows - 1 for input versionsi++ when you want ABCDE, ABCD, …i (that becomes Program 6)- 1 in the top formulaprintf("\n") inside the letter loopPrint the inverted alphabet triangle the beginner-friendly way.
End shrinks, letters ascend
Definitionj from A to i
CodeEvery row starts at A
ShapeOnly outer flips
CompareO(n²) time
AnalysisThis is the inverted version of the usual growing alphabet triangle. For 5 rows, it prints ABCDE, ABCD, ABC, AB, A by shrinking the row length each line while still starting from 'A'.
Inverted shapes are a small loop change away from the standard triangle.
12 people found this page helpful