fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int a, b;
  5. cin >> a >> b;
  6. for (int i = a; i <= b; ++i) {
  7. if (i % 2 == 0) {
  8. cout << i << " ";
  9. }
  10. }
  11. cout << "\n";
  12. for (int i = b; i >= a; --i) {
  13. if (i % 2 != 0) {
  14. cout << i << " ";
  15. }
  16. }
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 4372KB
stdin
9 20
stdout
10 12 14 16 18 20 
19 17 15 13 11 9