fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int numRows = 6;
  6. char ch = 'A';
  7.  
  8. for (int i = 1; i <= numRows; ++i) {
  9. // Print characters from 'A' to the current character
  10. for (int j = 1; j <= i; ++j) {
  11. cout << ch++ << " ";
  12. }
  13. cout << endl;
  14. ch = 'A'; // Reset character to 'A' for next row
  15. }
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5304KB
stdin
Standard input is empty
stdout
A 
A B 
A B C 
A B C D 
A B C D E 
A B C D E F