fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int x[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  6. int k[4] = {1, 2, 3, 4};
  7. int res[10];
  8. for (int i = 0; i < 10; ++i) {
  9. res[i] = x[i] + k[i % 4];
  10. }
  11. for(int val : res) {
  12. cout << val << ' ';
  13. }
  14. return 0;
  15. }
Success #stdin #stdout 0.01s 5408KB
stdin
Standard input is empty
stdout
2 4 6 8 6 8 10 12 10 12