fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n;
  7. cin>>n;
  8. int a[n];
  9. for(int i=0;i<n;i++){
  10. cin>>a[i];
  11. }
  12. int i=0;
  13. int j=n-1;
  14.  
  15. while(i<=j){
  16. int temp=0;
  17. temp=a[i];
  18. a[i]=a[j];
  19. a[j]=temp;
  20. i++;j--;
  21. }
  22. for(int i=0;i<n;i++){
  23. cout<<a[i];
  24. }
  25.  
  26. // cout << "Hello, World!";
  27. return 0;
  28. }
Success #stdin #stdout 0.01s 5300KB
stdin
3
1
2
3
stdout
321