Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #define WIDE 9
- #define HIGH 5
- //to do this for obshii case, with SIZE and GAP, even SIZE, vertical GAP, horis GAP
- //columns_gap, rows_gap
- //this one is really easy now to change into summarasing array elements in
- //particular triangle are of array
- //seems that HIGH and WIDE was bad name choice even for particular case, have
- //to check it - how fast will i rewrite this programm with different var names
- int main()
- {
- int i,j,arr[HIGH][WIDE];
- for(i=0;i<HIGH;i++)//populate&print array
- {
- for(j=0;j<WIDE;j++)
- {
- arr[i][j] = WIDE*i+j;
- printf("%4d",arr[i][j]);
- }
- printf("\n");
- }
- for(i=0;i<HIGH;i++)//1
- {
- for(j=0;j<WIDE;j++)//in array formula(limits for j) will go here!!!
- {
- printf("%c",(j>=(WIDE-HIGH)/2&&j<=(WIDE-HIGH)/2+i)?'*':'-');//1 star
- }
- printf("\n");
- }
- for(i=0;i<HIGH;i++)//2. only to illustrate, which area I work with
- {
- for(j=0;j<WIDE;j++)
- {
- printf("%c",(j>=(WIDE-HIGH)/2&&j<(WIDE-HIGH/2)-i)?'*':'-');//10 stars+0 space
- }
- printf("\n");
- }
- for(i=0;i<HIGH;i++)//3.only to illustrate, which area I work with
- {
- for(j=0;j<WIDE;j++)
- {
- printf("%c",(j>=(WIDE+HIGH)/2-i-1&&j<WIDE-HIGH/2)?'*':'-');//9 spaces
- }
- printf("\n");
- }
- for(i=0;i<HIGH;i++)//only to illustrate, which area I work with
- {
- for(j=0;j<WIDE;j++)
- {
- printf("%c",(j>=(WIDE-HIGH)/2+i&&j<WIDE-HIGH/2)?'*':'-');//0 space+10 stars
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement