fork download
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<ctime>
  4. using namespace std;
  5.  
  6. int main() {
  7. int c;
  8. int n = 1;
  9. int s;
  10. srand(time(0));
  11. int r = (rand() % 12) + 1;
  12.  
  13. for (c = 0; n >= 1 && n <= r; n++) {
  14. for (s = r - n; s >= 1; s--) {
  15. cout << " " << "\t";
  16. }
  17. for (c = 0; c < n; c++) {
  18. cout << n << "\t";
  19. }
  20. cout << endl;
  21. }
  22.  
  23. return 0 ;
  24. }
Success #stdin #stdout 0s 3468KB
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	
 	 	7	7	7	7	7	7	7	
 	8	8	8	8	8	8	8	8	
9	9	9	9	9	9	9	9	9