fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int h;
  5. scanf("%d",&h);
  6. for (int i = 0; i<h; ++i) {
  7. for (int j = 1; j<(2*h); ++j) {
  8. if (i!=h-1) {
  9. if (j==(h-i) || j==(h+i)) {
  10. printf("*");
  11. } else printf(" ");
  12. } else {
  13. printf("*");
  14. }
  15. }
  16. printf("\n");
  17. }
  18. }
Success #stdin #stdout 0.01s 5320KB
stdin
5
stdout
    *    
   * *   
  *   *  
 *     * 
*********