fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int numRows = 6;
  6.  
  7. for (int i = 1; i <= numRows; ++i) {
  8. // Print the number i repeatedly i times
  9. for (int j = 1; j <= i; ++j) {
  10. cout << i << " ";
  11. }
  12. cout << endl;
  13. }
  14.  
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5296KB
stdin
Standard input is empty
stdout
1 
2 2 
3 3 3 
4 4 4 4 
5 5 5 5 5 
6 6 6 6 6 6