/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
https://www.onlinegdb.com/?__cf_chl_jschl_tk__=92e903bd3271c24c128f7493cf87beb27489a7ef-1603876457-0-AQTyIv7w0yZ87LxBOHvu_9NzsOynDlp78k9j2Gwq4jDYFLSPcypRPluiOqrkEndleEK54xZT4llfN2KWJYKWG41Nx99tIBAkH5QojxWN2lkIeIHJPAvrfVvQWQtWeFfjH34L_imC-YHqfksLd2h8e4Dkbf3CCUHIKe0PA5VUDMdbEoBiMkcOxOCAkR6AlC2P3Rx0jzIidqbbJjfUuccQTiuAXfpT8ubntV9oS1rSLq-Th1yRFrI1pUD9baCeGxJxjHxVzU3fMVMSImY-_aOcNNA#editor_1C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
int arr1[] = { 2, 2, 2, 2 };
int arr2[] = { 1, 1, 1, 1 };
int result[4];
for(int i = 0; i < 4; ++i){
result[i] = i % 2 == 0 ? arr1[i] + arr2[i] : arr1[i] - arr2[i];
}
cout << "Result are: ";
// Printing array elements
for (const int &n : result) {
cout << n << " ";
}
return 0;
}