Advertisement
Guest User

#488 Afisare

a guest
Feb 20th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4. int main()
  5. {
  6. int v[1000];
  7. long int i,n;
  8. cin>>n;
  9. for(i=1; i<=n; i++)
  10. cin>>v[i];
  11. for(i=2; i<=n; i+=2)
  12. cout<<v[i]<<" ";
  13. cout<<'\n';
  14. if(n%2==1)
  15. {
  16. for(i=n; i>=1; i-=2)
  17. cout<<v[i]<<" ";
  18. }
  19. else
  20. {
  21. for(i=n-1; i>=1; i-=2)
  22. cout<<v[i]<<" ";
  23. }
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement