fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. //#define abs(x) ((x) >= 0 ? (x) : -(x))
  5. int main()
  6. {
  7. int a, b, c;
  8. cin >> c;
  9. for (a = -c + 1; a < c; a++) {
  10. for (b = -c + 1; b < c; b++)
  11. cout << (abs(a) + abs(b) < c ? ' ' : '*');
  12. cout << endl;
  13. }
  14. return 0;
  15. }
Success #stdin #stdout 0s 15232KB
stdin
11
stdout
********** **********
*********   *********
********     ********
*******       *******
******         ******
*****           *****
****             ****
***               ***
**                 **
*                   *
                     
*                   *
**                 **
***               ***
****             ****
*****           *****
******         ******
*******       *******
********     ********
*********   *********
********** **********