fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int rows;
  6. cout << "Enter number of rows: ";
  7. cin >> rows;
  8.  
  9. // Outer loop for rows
  10. for (int i = 1; i <= rows; i++) {
  11. // Inner loop for characters in each row
  12. for (int j = 0; j < i; j++) {
  13. cout << char('A' + j);
  14. }
  15. cout << endl; // Move to next line after each row
  16. }
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 5316KB
stdin
6
stdout
Enter number of rows: A
AB
ABC
ABCD
ABCDE
ABCDEF