fork download
  1.  
  2. #include <iostream>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8. ios_base::sync_with_stdio(false);
  9. cin.tie(NULL);
  10.  
  11. int n;
  12. cin >> n;
  13.  
  14. vector<int> ted(n);
  15.  
  16. for (int i = 0; i < ted.size(); i++) {
  17. cin >> ted[i];
  18. }
  19.  
  20.  
  21. for (int i = 0; i < ted.size(); i++) {
  22. cout << ted[i]<< " ";
  23. }
  24. cout << endl;
  25.  
  26. for (int i = 0; i < ted.size(); i++) {
  27. if(ted[i] %2 != 0){
  28.  
  29. cout << ted[i] << " ";
  30. }
  31. }
  32.  
  33.  
  34.  
  35.  
  36.  
  37. return 0;
  38. }
Success #stdin #stdout 0s 5316KB
stdin
7
3 4 8 9 -15 20 21
stdout
3 4 8 9 -15 20 21 
3 9 -15 21