Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int n;
- float a[1000];
- void read_array(int n)
- {
- for (int i = 0; i < n; i++)
- cin >> a[i];
- }
- float get_average(int n, float a[])
- {
- float average = 0.0;
- for (int i = 0; i < n; i++)
- average += a[i];
- average /= (float) n;
- return average;
- }
- int Count(int n, float a[])
- {
- float average = get_average(n, a);
- int k = 0;
- for (int i = 0; i < n; i++)
- if (average <= a[i])
- k++;
- return k;
- }
- int main()
- {
- cin >> n;
- read_array(n);
- cout << Count(n, a);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement