Lucian_Adrian

#488 Afisare

Nov 23rd, 2021
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int n, v[1005];
  5.  
  6. int main()
  7. {
  8. cin >> n;
  9. for(int i = 1; i <= n ;++i)
  10. cin >> v[i];
  11. for(int i = 2 ; i <= n ; i += 2)
  12. cout << v[i] << " ";
  13. cout << endl;
  14. if(n%2==0)
  15. n --;
  16. for(int i = n ; i > 0 ; i -= 2)
  17. cout << v[i] << " ";
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment