fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int ile,n;
  6.  
  7. int main()
  8. {
  9. cin >> ile;
  10. for(int a=0; a<ile; a++)
  11. {
  12. cin >> n;
  13. if (n<1)
  14. n=1;
  15. if (n>100)
  16. n=100;
  17. int *tab=new int[n];
  18. int *pom=new int[n];
  19. for (int b=0; b<n; b++)
  20. {
  21. cin >> tab[b];
  22. }
  23. int x=0,y=0;
  24. do
  25. {
  26. if (tab[x]%2==0)
  27. cout << tab[x]<<" ";
  28. else
  29. {
  30. pom[y]=tab[x];
  31. y++;
  32. }
  33. x++;
  34. }
  35. while (x<n);
  36. for (int c=0; c<y; c++)
  37. {
  38. cout << pom[c]<<" ";
  39. }
  40. cout << endl;
  41. delete tab;
  42. delete pom;
  43. }
  44. return 0;
  45. }
  46.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty