fork download
  1.  
  2.  
  3. #include <stdio.h>
  4.  
  5. int main()
  6. {
  7. int row, c, n, temp;
  8.  
  9. printf("Enter the number of rows in pyramid of stars you wish to see ");
  10. scanf("%d",&n);
  11.  
  12. temp = n;
  13.  
  14. for ( row = 1 ; row <= n ; row++ )
  15. {
  16. for ( c = 1 ; c < temp ; c++ )
  17. printf(" ");
  18.  
  19. temp--;
  20.  
  21. for ( c = 1 ; c <= 2*row - 1 ; c++ )
  22. printf("*");
  23.  
  24. printf("\n");
  25. }
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0s 2172KB
stdin
10
stdout
Enter the number of rows in pyramid of stars you wish to see          *
        ***
       *****
      *******
     *********
    ***********
   *************
  ***************
 *****************
*******************