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 5280KB
stdin
5
1 1 1 34
1200
2 3 2 10
100 10 1
3 3 3 3
1 2 3
4 2 2 7
5 8
999 1 999 6
3
stdout
120034111