Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <cs50.h>
- int main(void)
- {
- int h;
- do
- {
- // asks for an integer; height here is the string that is asked and get int means it requires an integer response
- h = get_int("height:");
- }
- while (h > 0 || h < 23 );
- int i;
- int s;
- int b;
- // for rows
- for (i=0; i<h; i++)
- {
- //for spaces
- for (s=0; s<h-i; s++)
- {
- printf (" ");
- }
- //for bricks
- for (b=0; b<i+1; b++)
- {
- printf("#");
- }
- {
- printf("\n");
- }
- }
- }
Add Comment
Please, Sign In to add comment