Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main() {
- int arrLen, sumNumbers = 0, averageNum;
- cin >> arrLen;
- int* numbers = new int[arrLen];
- for (size_t i = 0; i < arrLen; i++) {
- cin >> numbers[i];
- sumNumbers += numbers[i];
- }
- sort(numbers, numbers + arrLen, greater<int>());
- averageNum = (double)sumNumbers / arrLen;
- if (numbers[arrLen - 1] >= averageNum) {
- cout << "No";
- }
- else {
- for (size_t i = 0; i < arrLen; i++) {
- if (numbers[i] < averageNum && numbers[i] % 2 == 0) {
- cout << numbers[i] << ' ';
- }
- }
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement