The descending alphabet triangle starts each row at its own letter and counts back to A: A, then B A, then C B A. The first column spells A to E and the last column is all A.
Quick answer: Row i prints i letters, and the letter at position j is 'A' + i − j. On row 3 that gives C, B, A. Every row ends at A and starts one letter later than the row above.
This program is part of the String Patterns collection.
Table of contents8 sections
Descending Alphabet Triangle output
Output (n = 5):
A B A C B A D C B A E D C B A

Same shape, other characters: the 0-1 (Binary) Triangle, Alphabet Triangle, Hash (#) Right Triangle, Incremental Alphabet Triangle and Reverse Alphabet Triangle programs draw this same outline with different characters. Putting them side by side shows which part of the loop decides the shape and which part decides what is printed.
How the descending alphabet triangle works
Here both loop counters matter. i sets the first letter of the row and j walks back from it. The expression i − j is 0 at the end of every row, which is why each row lands on A. It is the letter version of the descending number triangle (1, 21, 321).
- Run the outer loop for
ifrom1ton, one row per pass. - Print
iletters (letter numberi − j + 1). - Move to the next line.
Key takeaways
- Each row starts at its own letter and counts back to A.
'A' + i − jis the row letter minus the steps taken.- The first column is A, B, C, D, E; the last column is all A.
- It is the mirror image, letter by letter, of the alphabet triangle.
Descending Alphabet Triangle in C
#include <stdio.h>
int main(void) {
int n = 5;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i; j++)
printf("%c ", 'A' + i - j + 1 - 1);
printf("\n");
}
return 0;
}Descending Alphabet Triangle in C++
#include <iostream>
using namespace std;
int main() {
int n = 5;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i; j++)
cout << char('A' + i - j + 1 - 1) << " ";
cout << endl;
}
return 0;
}Descending Alphabet Triangle in Java
public class DescendingAlphabetTriangle {
public static void main(String[] args) {
int n = 5;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i; j++)
System.out.print((char) ('A' + i - j + 1 - 1) + " ");
System.out.println();
}
}
}Descending Alphabet Triangle in Python
n = 5
for i in range(1, n + 1):
for j in range(1, i + 1):
print(chr(ord('A') + i - j + 1 - 1), end=" ")
print()Time and space complexity
The program prints one character for each position in the pattern, so for n rows it runs in O(n²) time. It only needs a few loop variables, so the extra memory is O(1).
Frequently asked questions
How is it different from E, E D, E D C?
The reverse alphabet triangle always starts at E. This one starts at the row’s own letter, so row 2 is B A here but E D there.
Why does every row end with A?
At the last position of row i, j equals i, so the letter is 'A' + 0, which is A.
How do I print it without spaces?
Drop the space after each letter: the rows become A, BA, CBA, DCBA, EDCBA.
Can I right-align it?
Yes. Print n − i double spaces before each row, because each letter takes two characters with its space.






