fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8. int len,spLen = 1;//spaceLen
  9. cin >> len;
  10. for(int i=0;i < len*2-1; i++){
  11. for(int j=0; j < len - spLen; j++){
  12. cout<<"*";
  13. }
  14. for(int j=0; j < spLen*2-1; j++){
  15. cout<<" ";
  16. }
  17. for(int j=0; j < len - spLen; j++){
  18. cout<<"*";
  19. }
  20. cout << endl;
  21. if(i<len-1){++spLen;}
  22. else{--spLen;}
  23. }
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0s 15232KB
stdin
11
stdout
********** **********
*********   *********
********     ********
*******       *******
******         ******
*****           *****
****             ****
***               ***
**                 **
*                   *
                     
*                   *
**                 **
***               ***
****             ****
*****           *****
******         ******
*******       *******
********     ********
*********   *********
********** **********