Advertisement
Spocoman

08. Top Integers

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