Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void main()
- {
- int a=0,b=0,c=0,d=0,m=0,n=0,x,y,i,j,k,arr[15],par[5],impar[5];
- for(i=0;i<15;i++)
- scanf("%d",&arr[i]);
- for(j=0;j<15;j++)
- {
- if(a==5)
- {
- for(m=0;m<5;m++)
- printf("impar[%d] = %d\n",m,impar[m]);
- a=0;
- }
- if(b==5)
- {
- for(n=0;n<5;n++)
- printf("par[%d] = %d\n",n,par[n]);
- b=0;
- }
- if(arr[j]%2!=0)
- {
- impar[c]=arr[j];
- ++c;
- a++;
- if(c==5) c=0;
- }
- if(arr[j]%2==0)
- {
- par[d]=arr[j];
- ++d;
- b++;
- if(d==5) d=0;
- }
- }
- for(x=0;x<a;x++)
- printf("impar[%d] = %d\n",x,impar[x]);
- for(y=0;y<b;y++)
- printf("par[%d] = %d\n",y,par[y]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement