fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin >> n;
  7. int a[n];
  8. int S = 0;
  9. for (int i = 0; i < n; i++){
  10. a[i] = i + 1;
  11. if (a[i] % 2 == 0) {
  12. S = a[i] + a[i];
  13. }
  14. }
  15. cout << S;
  16. return 0;
  17. }
Success #stdin #stdout 0s 5336KB
stdin
6
stdout
12