Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //prints triangles vertically
- #include <stdio.h>
- #define SIZE 3
- #define GAP 2
- void pr_it(int,int);//
- int main()
- {
- pr_it(SIZE,GAP);
- return 0;
- }
- void pr_it(int s,int g)
- {
- int row,col;
- for(row=0;row<s;row++)
- {
- for(col=0;col<4*s+3*g;col++)
- {
- //stars
- if(( col>=0 &&col<=row)
- ||(col>=s+g &&col<2*s+g-row)
- ||(col>=3*s+2*g-row-1 &&col<3*s+2*g)
- ||(col>=3*s+3*g+row &&col<=4*s+3*g+1))
- printf("*");
- else
- printf("-");
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement