Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(void)
- {
- int height = 0;
- char buf[150] = { 0 };
- while (height < 1 || height > 23)
- {
- printf("Height: ");
- if (fgets(buf, sizeof(buf), stdin) != NULL)
- height = atoi(buf);
- }
- for (int i = 0; i < height; i++)
- {
- for (int j = 0; j < height - i - 1; j++)
- printf(" ");
- for (int j = 0; j < i + 1; j++)
- printf("#");
- printf("#\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement