Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cs50.h>
- #include <stdio.h>
- //funtions declaration
- void printhash(int times);
- void printblank(int times);
- int main(void)
- {
- int h;
- //askin for the height until is between 1 and 8
- do
- {
- h = get_int("Height: ");
- }
- while (h < 1 || h > 8);
- //printing the rows
- for (int row = 0; row < h; row++)
- {
- printblank(h - (row + 1));
- printhash(row + 1);
- printf(" ");
- //making the mirror
- printhash(row + 1);
- printf("\n");
- }
- }
- void printhash(int times)
- {
- for (int n = 0; n < times; n++)
- {
- printf("#");
- }
- }
- void printblank(int times)
- {
- for (int n = 0; n < times; n++)
- {
- printf(" ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement