Shape Rule
Shrinking rows
Lengths 5, 4, 3, 2, 1 with continuous letters.

Print a continuous alphabet sequence across rows, while each next row prints one fewer letter than the previous. Keep a running counter (k++) so the sequence goes A through O for five rows. Compare Program 22 (right-aligned growing sequential pyramid) and Program 13 (left-aligned growing sequential). Includes a live preview, worked C examples, edge cases, and complexity.
Shrinking rows
Lengths 5, 4, 3, 2, 1 with continuous letters.
Never reset
k++ streams A…O across all rows.
n..i
Loop j from n down to i for row length.
%c
Letter plus trailing space for readable columns.
1–6 rows
Pick a height (max 6 keeps letters within A–U).
Complexity
Total letters = n(n+1)/2.
A sequential decreasing alphabet triangle fills shrinking rows from a single continuous letter stream, so the alphabet never restarts at the start of a new line.
In C you solve it with nested loops, a running char counter, and optional width formatting for readable spacing.
It combines continuous counters with shrinking loop bounds — the mirror image of growing sequential triangles.
k never resets between rows.
Each row prints one fewer letter.
%2c plus a trailing space.
Opposite of Program 13 / 22 growth.
In short: for each row i, print n - i + 1 letters from the shared k++ stream, then call printf("\n").
Given a row count n (or fixed 5), print a left-aligned triangle of continuous alphabet letters with shrinking row lengths.
// Five rows (continuous stream; lengths 5..1)
// A B C D E
// F G H I
// J K L
// M N
// O | Item | Type | Description |
|---|---|---|
n | int | Number of rows. Letter count = n(n+1)/2 (15 for n=5). |
| Printed output | text | Continuous letters in shrinking left-aligned rows. |
k = 'A'
for i in 1..n:
for j from n down to i:
print k with spacing; k++
print newline | Approach | Idea | Best for |
|---|---|---|
| j from n down to i | Classic shrinking bound | Matching this sample |
| Print (n-i+1) times | Explicit count per row | Clearer reading / teaching rewrite |
| Goal | Pattern |
|---|---|
| Counter | char k = 'A'; (outside outer loop) |
| Rows | for (int i = 1; i <= n; i++) |
| Shrink letters | for (int j = n; j >= i; j--) |
| Print letter | printf("%c ", k++); |
| Growing sequential | See Program 13 / Program 22 |
Same triangle — three roles that build the decreasing pattern.
streamContinues A, B, C… across every row
shrinkRow length falls by one each time
spaceLetter plus separator space
breakEnds the row; k keeps its value
Reach for this when teaching continuous counters with shrinking loop bounds.
Keep the running counter; flip the row lengths to shrink.
Same stream idea; growing + right-align vs shrinking + left-align.
Practice %2c spacing in monospace output.
Show why total letters equal n(n+1)/2.
This is a console teaching pattern — not how you build modern app screens.
Key benefit: keeping k outside while shrinking the inner bound is the cleanest way to teach continuous fill into a decreasing triangle.
Choose between 1 and 6 rows and draw the sequential decreasing triangle in the browser.
Three complete C programs — fixed 5 rows, scanf row count, and explicit letters-per-row count. Click View Output to reveal sample console results.
Print five shrinking rows with a continuous letter stream.
One counter k supplies letters; the inner loop decides how many times to print it in each row.
#include <stdio.h>
int main() {
int i, j;
char k = 'A';
for (i = 1; i <= 5; ++i) {
for (j = 5; j >= i; --j) {
printf("%c ", k++);
}
printf("\n");
}
return 0;
} When i = 3, the inner loop runs three times and prints the next three letters from k (J K L). Because k is outside the outer loop, the next row continues at M.
Let the user choose how many rows to print.
If rows are large, letters will go beyond Z unless you add wrapping. Check scanf and a letter-budget cap in real apps.
#include <stdio.h>
int main() {
int n, i, j;
char k = 'A';
printf("Enter number of rows (like 5): ");
scanf("%d", &n);
if (n < 1) return 0;
for (i = 1; i <= n; ++i) {
for (j = n; j >= i; --j) {
printf("%c ", k++);
}
printf("\n");
}
return 0;
} Same stream and shrink rules; only the shared width follows n. Letter count is n(n+1)/2 — cap so it stays ≤ 26 for A–Z only.
Same shape with an explicit letters-per-row count.
Often clearer to read: print n - i + 1 letters from the shared stream.
#include <stdio.h>
int main() {
int n = 5;
char k = 'A';
int i, t, count;
for (i = 1; i <= n; ++i) {
count = n - i + 1;
for (t = 0; t < count; ++t) {
printf("%c ", k++);
}
printf("\n");
}
return 0;
} Row 1 prints 5 letters; row 5 prints 1. Same continuous k++; only the loop bound style changes.
k is a running alphabet counterWe start at 'A' and increment only when printing a letter.
The inner loop runs 5, then 4, then 3, etc. as i increases.
%2c prints each letter in a 2-column field. A trailing space separates letters.
printf("\n") ends the row so the next shorter row continues the same k.
Total letters printed over n rows is n(n+1)/2, so work grows as O(n²).
Trace each row’s length and the letters taken from the running counter.
i | Letters | Count | Printed row |
|---|---|---|---|
1 | A..E | 5 | A B C D E |
2 | F..I | 4 | F G H I |
3 | J..L | 3 | J K L |
4 | M..N | 2 | M N |
5 | O | 1 | O |
Total letters: 5+4+3+2+1 = 15 (A through O).
Where this sequential decreasing triangle shows up beyond the homework prompt.
Clearest demo of a counter that never resets across shrinking rows.
Example: reset k once and see every row start at A.
Same stream — growing right-aligned vs shrinking left-aligned.
Example: print both for n = 5 side by side.
Change j = 1..i to grow instead of shrink.
Example: rebuild Program 13 from this page.
Teach count = n - i + 1 (Example 3).
Example: compare classic j-bound vs count loops.
Triangular letter counts make O(n²) easy to see.
Example: 5 rows print 15 letters.
Next pattern rotates fixed-length alphabet rows.
Example: continue to Program 26.
Pro Tip: say “keep counting letters, print one fewer each row” before coding — that story prevents resetting k or growing the rows by mistake.
Why this pattern earns a spot after growing sequential triangles.
A reset counter or growing bounds shows up immediately.
j-bound or explicit count teach the same shape.
A natural pair with Programs 13 and 22.
Streaming output needs no storage beyond loop variables.
Pro Tip: learn the classic j = n..i version first; treat the explicit count rewrite as a clarity upgrade afterward.
Small habits that keep sequential decreasing triangles clean.
Do not reset the counter each row if you want continuous letters.
Inner length should be n - i + 1, not i.
scanfAvoid crashes when the user types letters instead of a number.
Keep n(n+1)/2 ≤ 26 for A–Z-only output.
Proportional fonts make %2c spacing look uneven.
Pro Tip: if every row starts with A, you almost certainly reset k inside the outer loop.
Mistakes that commonly break sequential decreasing triangles.
Each row starts at A again — that is a different pattern.
→ Keep k outside the outer loop.
Using j = 1..i builds an inverted (growing) triangle.
→ Use j = n..i or count = n - i + 1.
Columns look uneven even when the code is correct.
→ View output in a monospace terminal/font.
scanfLetters or empty input leave n uninitialized.
→ Check scanf and re-prompt on failure.
Large n needs more than 26 letters.
→ Cap n so n(n+1)/2 ≤ 26, or define wrap/stop policy.
Check these inputs before calling the solution done.
Output is just A.
15 letters through O.
Through F (Example 2).
Needs 28 letters — decide wrap/stop policy.
scanf fails silently — check the return value.
Same loops with k = 'a'.
Try these variations to lock in the pattern.
count = n - i + 1 (Example 3)Quick Takeaway: keep counting letters across rows, print one fewer letter each time, then break the line.
| Program | Time | Extra space |
|---|---|---|
| Classic / input (Examples 1–2) | O(n²) | O(1) |
| Explicit count (Example 3) | O(n²) | O(1) |
Total printed letters are n+(n-1)+…+1 = n(n+1)/2, so time is O(n²).
The sequential decreasing alphabet triangle is a small nested-loop exercise with lasting payoff: a continuous letter counter paired with shrinking row lengths. Master the classic A…O sample, then try user input and the explicit count rewrite.
Practice the three examples above, then continue to Program 26’s rotating alphabet pattern.
Keep k outside, shrink the inner bound each row, print the next letters, then break the line.
j = n..i (or an explicit count)%2c output in a monospace fontscanf and cap the letter budgetk each row for this patternj = 1..i by accidentprintf("\n") inside the letter loopPrint the sequential decreasing alphabet triangle the beginner-friendly way.
Stream + shrink
DefinitionNever reset
Coden..1 each row
CodeEnds each row
I/OO(n²) time
AnalysisOne counter k starts at A and never resets. The outer loop controls row count; the inner loop length decreases each row (5, 4, 3, 2, 1). Using printf("%c ", k++) (or %2c) keeps a clean spaced layout in monospace output.
Next up: rotating alphabet patterns with nested loops.
12 people found this page helpful