Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define SIZE 10
- //https://otvet.mail.ru/question/218122064
- //otsortirovat; elem s nechet ind v porjadke vozrastanija
- int main()
- {
- int s,t,i,j,arr[SIZE]={1,2,3,4,5,6,7,8,9,10};
- char ch_arr[2*SIZE][2*SIZE]={0};
- char k = '1';
- for(i=0;i<2*SIZE-1;i++)
- {
- for(j=0;j<2*SIZE-1;j++)
- {
- if(i<SIZE&&j>=SIZE&&(j-i==SIZE-1))//2 chetvert
- {
- //printf("i-%d, j-%d\n ",i,j);
- ch_arr[i][j]=k;
- k++;
- //ch_arr[i][j]='&';
- }
- else if(i<SIZE&&j<SIZE&&(i+j==SIZE-1))//1 chetvert
- {
- //printf("i-%d, j-%d\n ",i,j);
- ch_arr[i][j]='*';
- }
- else if(i>=SIZE&&j<=SIZE&&(i-j==SIZE-1))//3 chetvert
- {
- //printf("i-%d, j-%d\n ",i,j);
- ch_arr[i][j]='#';
- }
- else if(i>=SIZE&&j>=SIZE&&((i+j)==3*SIZE-3))//4 chetvert
- //else if(i>=SIZE&&j>=SIZE&&((i+j)==2*SIZE+4))//4
- {
- //printf("i-%d, j-%d\n ",i,j);
- ch_arr[i][j]='%';
- }
- else
- {
- ch_arr[i][j]='-';
- }
- }
- }
- for(i=0;i<2*SIZE;i++)
- {
- for(j=0;j<2*SIZE;j++)
- {
- printf("%c ",ch_arr[i][j]);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement