Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- { const int n=5;
- int a[2*n]={1,4,2,6,3,2,5,4,6,4},i,y[2*n];
- for (i=1;i<(2*n);i++)
- {
- if ((i+1)%2 == 0)
- y[i]=a[i+1];
- else
- y[i]=a[i-1];
- }
- y[0]=a[2*n-1];
- y[2*n-1]=a[0];
- for(i=0;i<(2*n);i++)
- cout<<y[i]<<' ';
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment