Advertisement
S_h_u_v_r_o

1179

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