Aleksandr_Grigoryev

HW 11g

Nov 22nd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {   const int n=5;
  5. int a[2*n]={1,4,2,6,3,2,5,4,6,4},i,y[2*n];
  6. for (i=1;i<(2*n);i++)
  7. {
  8.     if ((i+1)%2 == 0)
  9. y[i]=a[i+1];
  10.     else
  11.         y[i]=a[i-1];
  12. }
  13. y[0]=a[2*n-1];
  14. y[2*n-1]=a[0];
  15. for(i=0;i<(2*n);i++)
  16. cout<<y[i]<<' ';
  17. system("pause");
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment