Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <cs50.h>
  2. #include <stdio.h>
  3.  
  4. int main(void)
  5. {
  6. int height;
  7. int hash;
  8. int row;
  9. int space;
  10.  
  11. do
  12. {
  13. height = get_int("Height between 1-8: ");
  14. }
  15.  
  16. while (height < 1 || height > 8);
  17. {
  18. if (height > 0 && height < 9) {
  19. printf("Stored: %i\n", height);
  20. }
  21. }
  22.  
  23. for (row = 1; row <= height; row++)
  24. {
  25. for (space = 0; space < height - row; space++)
  26. {
  27. printf(" ");
  28. }
  29. for (hash = 1; hash <= row; hash++)
  30. {
  31. printf("#");
  32. }
  33. printf("\n");
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement