fork download
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int i, space, rows, k=0;
  5.  
  6. printf("Enter number of rows: ");
  7. scanf("%d",&rows);
  8.  
  9. for(i=1; i<=rows; ++i, k=0)
  10. {
  11. for(space=1; space<=rows-i; ++space)
  12. {
  13. printf(" ");
  14. }
  15.  
  16. while(k != 2*i-1)
  17. {
  18. printf("* ");
  19. ++k;
  20. }
  21.  
  22. printf("\n");
  23. }
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
Enter number of rows: