fork download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. int height=5;
  6. //build pyramid
  7. for (int i=height;i>=1;i--)
  8. {
  9. //add spaces
  10. for (int space =1;space<i;space++)
  11. printf(" ");
  12.  
  13. //add hashtags
  14. for (int hash=height;hash>=i-1;hash--)
  15. printf("#");
  16.  
  17. printf("\n");
  18. }
  19. }
Success #stdin #stdout 0s 2168KB
stdin
Standard input is empty
stdout
    ##
   ###
  ####
 #####
######