fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int num1;
  7.  
  8. cout << "please enter a size between 1-9: ";
  9. cin >> num1;
  10.  
  11. cout << endl;
  12.  
  13. for(int i = 0; i < num1; ++i)
  14. {
  15. for(int j = 0; j < i; ++j)
  16. cout << "*";
  17.  
  18. cout << num1;
  19.  
  20. for(int j = num1-1; j > i; --j)
  21. cout << "*";
  22.  
  23. cout << "\n";
  24. }
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 15232KB
stdin
6
stdout
please enter a size between 1-9: 
6*****
*6****
**6***
***6**
****6*
*****6