Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void drawTree(int h);
- int main()
- {
- int h;
- char c;
- int hi;
- int si;
- int pi;
- repeat:
- printf("Podaj wysokosc: ");
- scanf("%d", &h);
- if(h%2 == 0)
- {
- c = '*';
- } else {
- c = '#';
- }
- hi = 1;
- drawTree:
- si = 0;
- pi = 0;
- drawSpace:
- if(h>hi+si)
- {
- printf(" ");
- si++;
- goto drawSpace;
- }
- drawPoint:
- if(h>pi-hi*2+h+1)
- {
- printf("%c",c);
- pi++;
- goto drawPoint;
- }
- if(hi < h)
- {
- hi++;
- printf("\n");
- goto drawTree;
- }
- printf("\n");
- if(h >=7)
- {
- goto stop;
- }
- goto repeat;
- stop:
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement