fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int n;
  7. cin >> n;
  8. bool found =false ;
  9. for (int i=1; i<=n; i++)
  10. {
  11. if (i%2==0)
  12. {
  13. cout << i << endl;
  14. found = true;
  15. }
  16. }
  17. if (!found) {
  18. cout << "-1" << endl;
  19. }
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. }
  27.  
  28.  
Success #stdin #stdout 0.01s 5320KB
stdin
10
stdout
2
4
6
8
10