Advertisement
Spocoman

03. Above Average

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