fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_LENGTH = 1000;
  5.  
  6. int main() {
  7. int n, v[MAX_LENGTH + 1];
  8. cin >> n;
  9. for (int i = 1; i <= n; ++i) {
  10. cin >> v[i];
  11. }
  12. for (int i = n; i >= 1; --i) {
  13. if (v[i] % 2 == 0) {
  14. cout << v[i] << ' ';
  15. }
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
Standard output is empty