Advertisement
nq1s788

Вывести числа в обратном порядке

May 22nd, 2024
1,157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include<iostream>
  2. #include<vector>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int n;
  8.     cin >> n;
  9.     vector<int> a(n); ///5 7 8 9 6 8
  10.     for (auto& e : a) cin >> e;
  11.     for (int i = n - 1; i >= 0; i--) {
  12.         cout << a[i] << ' ';
  13.     }
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement