Advertisement
Spocoman

02. Print Numbers in Reverse Order

Nov 17th, 2023
830
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     const int MAX_SIZE = 99;
  7.     int numbers[MAX_SIZE]{};
  8.    
  9.     int arrSize;
  10.     cin >> arrSize;
  11.  
  12.     for (int i = 0; i < arrSize; i++) {
  13.         cin >> numbers[i];
  14.     }
  15.  
  16.     for (int i = arrSize - 1; i >= 0; i--) {
  17.         cout << numbers[i] << ' ';
  18.     }
  19.  
  20.     cout << endl;
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement