fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6. int i, h = 3;
  7. char buf[80];
  8.  
  9. memset(buf, '*', h * 2 - 1);
  10. for (i = 0; i < h; i++) {
  11. printf("%*.*s\n", h + i, i * 2 + 1, buf);
  12. }
  13. for (i = h - 2; 0 <= i; i--) {
  14. printf("%*.*s\n", h + i, i * 2 + 1, buf);
  15. }
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0.01s 1676KB
stdin
Standard input is empty
stdout
  *
 ***
*****
 ***
  *