Advertisement
inhuman_Arif

Untitled

Nov 24th, 2020
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void main()
  4. {
  5.     int a=0,b=0,c=0,d=0,m=0,n=0,x,y,i,j,k,arr[15],par[5],impar[5];
  6.     for(i=0;i<15;i++)
  7.         scanf("%d",&arr[i]);
  8.     for(j=0;j<15;j++)
  9.     {
  10.         if(a==5)
  11.         {
  12.             for(m=0;m<5;m++)
  13.                 printf("impar[%d] = %d\n",m,impar[m]);
  14.             a=0;
  15.         }
  16.         if(b==5)
  17.         {
  18.             for(n=0;n<5;n++)
  19.                 printf("par[%d] = %d\n",n,par[n]);
  20.             b=0;
  21.         }
  22.         if(arr[j]%2!=0)
  23.         {
  24.             impar[c]=arr[j];
  25.             ++c;
  26.             a++;
  27.             if(c==5) c=0;
  28.         }
  29.         if(arr[j]%2==0)
  30.         {
  31.             par[d]=arr[j];
  32.             ++d;
  33.             b++;
  34.             if(d==5) d=0;
  35.         }
  36.     }
  37.     for(x=0;x<a;x++)
  38.         printf("impar[%d] = %d\n",x,impar[x]);
  39.     for(y=0;y<b;y++)
  40.         printf("par[%d] = %d\n",y,par[y]);
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement