Opens Down
Inverted V
Single A at the tip; pairs widen downward.

Draw an inverted V: one A at the top, then pairs like B B, C C, widening as you go down. Scan a fixed-width row and print letters only where the row index matches the column index. Compare Program 31 (normal V) and Program 34 (full diamond). Includes a live preview, worked C examples, edge cases, and complexity.
Inverted V
Single A at the tip; pairs widen downward.
n..0
Print when i == j; else space.
k = 1..n
Right leg starts at B so the tip stays single.
(n+1) + n
For A..E (n=4), each line spans 9 columns.
End letter
Pick an end letter (A–F) and draw the shape.
Complexity
n rows × O(n) column scans each.
An inverted V-shaped alphabet pattern places a single tip letter at the top and then prints matching letter pairs that move farther apart on each lower row.
In C you walk row index i, scan left columns from n down to 0, then scan right columns from 1 to n, printing only when i matches the column.
It is the natural mirror of Program 31 and the top half of Program 34’s diamond — so learning it once pays off twice.
Scan n..0 with i == j.
Scan 1..n; skip tip A.
Fill non-diagonal cells.
Top A prints once.
In short: for each row i, scan left n..0 printing when i == j, then scan right 1..n printing when i == k, then call printf("\n").
Given an end letter (or fixed E), print an inverted V of letters on two diagonals with spaces elsewhere and a single top tip.
// Five rows (end = E, width 9)
// A
// B B
// C C
// D D
// E E | Item | Type | Description |
|---|---|---|
end / n | char / int | End letter; n = end - 'A' (4 for E). Rows = n+1. |
| Printed output | text | Inverted V of width 2n+1 with letters on diagonals and spaces elsewhere. |
n = end - 'A'
for i from 0 to n:
for j from n down to 0: // left leg
print (i == j ? letter[j] : " ")
for k from 1 to n: // right leg (skip A)
print (i == k ? letter[k] : " ")
print newline | Approach | Idea | Best for |
|---|---|---|
| Two diagonal scans | Left n..0 + right 1..n with i==col | Matching this classic sample |
| Flip of Program 31 | Same rule; opposite opening direction | Comparing normal V vs inverted V |
| Goal | Pattern |
|---|---|
| Alphabet + n | char alpha[] = "ABCDEFG..."; int n = 4; |
| Rows | for (int i = 0; i <= n; i++) |
| Left leg | for (int j = n; j >= 0; j--) printf("%c", i == j ? alpha[j] : ' '); |
| Right leg | for (int k = 1; k <= n; k++) printf("%c", i == k ? alpha[k] : ' '); |
| Normal V | See Program 31 |
| Full diamond next | See Program 34 |
Four roles that open the inverted V without a double A.
leftReverse scan; prints when i == j
rightForward scan; skips tip A
fillKeep columns aligned
breakEnds each full-width row
Reach for this when teaching sparse diagonals that open downward from a single tip.
Flip the V: tip at the top instead of the bottom.
Practice i == j with spaces for alignment.
Skip A on the right so the top prints once.
Reuse this row logic, then mirror downward for a diamond.
This is a console teaching pattern — not how you build modern app screens.
Key benefit: left scan n..0 plus right scan 1..n is the cleanest way to open an inverted V with a single tip A.
Choose an end letter from A to F and draw the inverted V-shaped alphabet pattern in the browser.
Three complete C programs — fixed A–E, scanf end letter, and a print_cell helper. Click View Output to reveal sample console results.
Print a five-row inverted V with a single A at the tip.
Left scan runs from E..A, then right scan runs from B..E.
#include <stdio.h>
int main() {
char alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i, j, k;
for (i = 0; i <= 4; i++) {
for (j = 4; j >= 0; j--) {
if (i == j)
printf("%c", alpha[j]);
else
printf(" ");
}
for (k = 1; k <= 4; k++) {
if (i == k)
printf("%c", alpha[k]);
else
printf(" ");
}
printf("\n");
}
return 0;
} When i = 2, the left scan prints C while scanning down, and the right scan prints C when k = 2. On the first row, only the left scan can print A.
Let the user pick the end letter (like E).
The left scan is end..A and the right scan is B..end. Check scanf and validate a single A–Z character in real apps.
#include <stdio.h>
int main() {
char alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char end;
int n, i, j, k;
printf("Enter top letter (like E): ");
scanf(" %c", &end);
n = end - 'A';
for (i = 0; i <= n; i++) {
for (j = n; j >= 0; j--)
printf("%c", i == j ? alpha[j] : ' ');
for (k = 1; k <= n; k++)
printf("%c", i == k ? alpha[k] : ' ');
printf("\n");
}
return 0;
} n = end - 'A' scales both scans. For end = C, width is 2×2+1 = 5 and the tip is a single A.
Same inverted V with a shared cell helper for both legs.
Often clearer: one function applies the diagonal rule so left and right loops stay thin.
#include <stdio.h>
void print_cell(char alpha[], int row, int col) {
printf("%c", row == col ? alpha[col] : ' ');
}
int main() {
char alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int n = 4;
int i, j, k;
for (i = 0; i <= n; i++) {
for (j = n; j >= 0; j--)
print_cell(alpha, i, j);
for (k = 1; k <= n; k++)
print_cell(alpha, i, k);
printf("\n");
}
return 0;
} print_cell owns the row == col rule once. The right loop still starts at 1 to keep a single tip A.
Row index i runs 0..n, representing A..end (A..E when n = 4).
Scan j = n..0. Print the letter only when i == j; otherwise print a space.
Scan k = 1..n (B..E). Skipping A ensures the first row prints only one A.
Left block has n+1 columns; right block has n columns. Total width is 2n+1 (9 for A..E).
Letters appear only on matching diagonals; everything else is a space — O(n²) time.
Trace each row’s diagonal hits and the resulting 9-column line.
i | Left hit | Right hit | Printed row |
|---|---|---|---|
0 | A at j=0 | (none) | A |
1 | B at j=1 | B at k=1 | B B |
2 | C at j=2 | C at k=2 | C C |
3 | D at j=3 | D at k=3 | D D |
4 | E at j=4 | E at k=4 | E E |
Width is always 2×4+1 = 9. The tip row has no right-leg match because k never equals 0.
Where this inverted V alphabet pattern shows up beyond the homework prompt.
Clearest demo of letter pairs that open downward.
Example: temporarily print . instead of spaces to see columns.
Learn why the right leg must skip A.
Example: start right at 0 and watch a double A.
Same diagonal idea; opposite opening direction.
Example: place both outputs side by side.
Factor the diagonal rule into print_cell (Example 3).
Example: reuse print_cell for Program 34 later.
Full grid scans make O(n²) easy to see even when few letters print.
Example: 5 rows × 9 cells = 45 writes.
Reuse this row logic, then mirror D..A for a diamond.
Example: continue to Program 34.
Pro Tip: say “left n..0, right 1..n, spaces elsewhere” before coding — that story prevents a double tip A.
Why this pattern earns a spot right after the normal V.
A broken diagonal or double tip shows up immediately.
Same i == col rule; only scan directions change.
Change n and the whole inverted V grows.
This row logic becomes the top half of the diamond.
Pro Tip: check alignment in a monospace font; proportional fonts make spaces look uneven.
Small habits that keep inverted V alphabet patterns clean.
Starting at 0 duplicates the tip A.
Skipping spaces collapses the shape into packed letters.
Use n = end - 'A' so scaling stays automatic.
scanfRequire a single A–Z character; use toupper if needed.
Proportional fonts hide whether columns really align.
Pro Tip: if the first row shows A A, the right scan almost certainly started at k = 0.
Mistakes that commonly break inverted V alphabet patterns.
Duplicates the tip A on the first row.
→ Start the right scan at k = 1.
Writing only letters collapses the inverted V.
→ Print a space whenever row != col.
Char math can walk past the alphabet.
→ Validate a single A–Z letter.
scanfEmpty or multi-character input leaves end unused or only takes the first char.
→ Check scanf’s return value and require a single A–Z letter.
Left 0..n and right (n-1)..0 draw a normal V, not this inverted one.
→ Keep left n..0 and right 1..n for this page.
Check these inputs before calling the solution done.
Output is just A (right leg empty).
5 rows × width 9 opening to E E.
3 rows × width 5 (Example 2).
Convert lowercase with toupper from <ctype.h> if needed.
Check scanf’s return value before using end.
Temporarily print . instead of spaces.
Try these variations to lock in the pattern.
print_cellrow == col; otherwise print a space.2n + 1 (9 for A..E).Quick Takeaway: scan left n..0 with i == j, scan right 1..n with i == k, fill spaces, keep one tip A, then break the line.
| Program | Time | Extra space |
|---|---|---|
| Inline / input (Examples 1–2) | O(n²) | O(1) (plus alphabet source) |
| Helper function (Example 3) | O(n²) | O(1) |
For n+1 letters there are n+1 rows and each row scans O(n) columns across both blocks, so total work is O(n²).
The inverted V-shaped alphabet pattern is Program 31 flipped: a single tip at the top and letter pairs that open downward. Master the classic A…E sample, then try user input and the helper rewrite.
Practice the three examples above, then continue to Program 34’s diamond-shaped alphabet pattern.
Left n..0 with i == j, right 1..n with i == k, spaces elsewhere, then break the line.
k = 1n from the end letterprintf("\n") inside either column loopPrint the inverted V-shaped alphabet pattern the beginner-friendly way.
Opens downward
Definitioni == col
CodeStart at B
Code2n+1 columns
ShapeO(n²) time
AnalysisTwo blocks per row. Left block scans E down to A and prints only when i == j. Right block scans B up to E and prints only when i == k. Because the right block never visits A, the first row prints a single A, while later rows print the same letter twice and the shape opens downward.
Next up: diamond-shaped alphabet patterns that reuse this inverted V for A..E, then mirror D..A without repeating the widest row.
12 people found this page helpful