Advertisement
Lisaveta777

Not completed

Jan 15th, 2020
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.47 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #define SIZE 10
  4. //https://otvet.mail.ru/question/218122064
  5. //otsortirovat; elem s nechet ind v porjadke vozrastanija
  6.  
  7.  
  8. int main()
  9. {
  10.     int s,t,i,j,arr[SIZE]={1,2,3,4,5,6,7,8,9,10};
  11.     char ch_arr[2*SIZE][2*SIZE]={0};
  12.     char k = '1';
  13.  
  14.     for(i=0;i<2*SIZE-1;i++)
  15.     {
  16.         for(j=0;j<2*SIZE-1;j++)
  17.         {
  18.             if(i<SIZE&&j>=SIZE&&(j-i==SIZE-1))//2 chetvert
  19.             {
  20.                 //printf("i-%d, j-%d\n ",i,j);
  21.                 ch_arr[i][j]=k;
  22.                 k++;
  23.                 //ch_arr[i][j]='&';
  24.             }
  25.             else if(i<SIZE&&j<SIZE&&(i+j==SIZE-1))//1 chetvert
  26.             {
  27.                 //printf("i-%d, j-%d\n ",i,j);
  28.                 ch_arr[i][j]='*';
  29.             }
  30.  
  31.             else if(i>=SIZE&&j<=SIZE&&(i-j==SIZE-1))//3 chetvert
  32.             {
  33.                 //printf("i-%d, j-%d\n ",i,j);
  34.                 ch_arr[i][j]='#';
  35.             }
  36.             else if(i>=SIZE&&j>=SIZE&&((i+j)==3*SIZE-3))//4 chetvert
  37.             //else if(i>=SIZE&&j>=SIZE&&((i+j)==2*SIZE+4))//4
  38.             {
  39.                 //printf("i-%d, j-%d\n ",i,j);
  40.                 ch_arr[i][j]='%';
  41.             }
  42.  
  43.             else
  44.             {
  45.                 ch_arr[i][j]='-';
  46.             }
  47.         }
  48.     }
  49.  
  50.         for(i=0;i<2*SIZE;i++)
  51.         {
  52.             for(j=0;j<2*SIZE;j++)
  53.             {
  54.                 printf("%c ",ch_arr[i][j]);
  55.             }
  56.             printf("\n");
  57.         }
  58.  
  59.  
  60.  
  61.     return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement