Print Alphabet Pattern (A to Z triangle)
C++
Hard
3 views
Problem Description
Print letters in triangular pattern.
Real Life: Understanding character printing in patterns.
Step-by-Step Logic:
1. Start with 'A'
2. Each row prints consecutive letters
3. Number of letters = row number
4. ASCII arithmetic for letters
Official Solution
void pattern_q15_alphabet_triangle() {
int n = 5;
for(int i = 1; i <= n; i++) {
char ch = 'A';
for(int j = 1; j <= i; j++) {
cout << ch << " ";
ch++;
}
cout << endl;
}
}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!