Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int row, c, n, s;
  6.  
  7. printf("Enter the number of rows in pyramid of stars you wish to see\n");
  8. scanf("%d", &n);
  9.  
  10. s = n;
  11.  
  12. for (row = 1; row <= n; row++) // Loop to print rows
  13. {
  14. for (c = 1; c < s; c++) // Loop to print spaces in a row
  15. printf(" ");
  16.  
  17. s--;
  18.  
  19. for (c = 1; c <= 2*row - 1; c++) // Loop to print stars in a row
  20. printf("*");
  21.  
  22. printf("\n");
  23. }
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement