Guest User

Untitled

a guest
Jul 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <cs50.h>
  3.  
  4. int main(void)
  5.  
  6. {
  7. int h;
  8. do
  9. {
  10. // asks for an integer; height here is the string that is asked and get int means it requires an integer response
  11. h = get_int("height:");
  12. }
  13. while (h > 0 || h < 23 );
  14.  
  15.  
  16.  
  17. int i;
  18. int s;
  19. int b;
  20. // for rows
  21. for (i=0; i<h; i++)
  22. {
  23. //for spaces
  24. for (s=0; s<h-i; s++)
  25. {
  26. printf (" ");
  27. }
  28. //for bricks
  29. for (b=0; b<i+1; b++)
  30. {
  31. printf("#");
  32. }
  33. {
  34. printf("\n");
  35. }
  36.  
  37. }
  38.  
  39. }
Add Comment
Please, Sign In to add comment