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