Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cs50.h>
- #include <stdio.h>
- void printspaces(int n);
- void printhash(int n);
- int main(void)
- {
- int height,spaces;
- do
- {
- height = get_int ("Height: ");
- }
- while (height < 1 || height >8);
- spaces = height-1;
- for (int i = height; i > 0; i--)
- {
- printspaces(spaces);
- printhash(height - spaces);
- printf("\n");
- spaces--;
- }
- }
- void printspaces(int n)
- {
- for (int i=0; i<n; i++)
- {
- printf(" ");
- }
- }
- void printhash(int n)
- {
- for (int i=0; i<n; i++)
- {
- printf("#");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement