fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define endl "\n";
  6.  
  7. int main() {
  8.  
  9. long long n;
  10. cin >> n;
  11. long long dem = 0;
  12.  
  13. for (int i = 1; i <= n; i++) {
  14. if (i % 2 == 0) {
  15. cout << i << " ";
  16. }
  17. }
  18. cout << endl;
  19.  
  20. return 0;
  21.  
  22. }
Success #stdin #stdout 0.01s 5312KB
stdin
15
stdout
2 4 6 8 10 12 14