Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void)
- {
- printf("Podaj wysokosc chinki: ");
- int h;
- scanf("%d", &h);
- printf("\nSposob 1:\n");
- for (int i = 1; i <= h; i = i + 1)
- {
- for (int b = h - i; b > 0; b = b - 1)
- {
- printf(" ");
- }
- for (int a = 1; a <= 2 * i - 1; a = a + 1)
- {
- printf("*");
- }
- printf("\n");
- }
- printf("\nSposob 2:\n");
- int c = 1;
- for (int i = 1; i <= h; i = i + 1)
- {
- for (int b = h - i; b > 0; b = b - 1)
- {
- printf(" ");
- }
- for (int a = 1; a <= c; a = a + 1)
- {
- printf("*");
- }
- printf("\n");
- c = c + 2;
- }
- printf("\nSposob 3:\n");
- for (int lctr = 0, hctr = 0; hctr < h; lctr == h + hctr + 1 ? (lctr = 0, ++hctr) : 0)
- printf("%c", lctr++ < h + hctr ? ((lctr < h - hctr) ? ' ' : '*') : '\n');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement