In: Computer Science
Answer:
C++ program:
#include<iostream>
#include<numeric>
using namespace std;
int main()
{
int arr[10],sum=0,i,count=0; //initializing the
variables
float average; // initializing the average as float
data type
int n=10; //size of array taken as 10 that is given in
question
for(i=0;i<n;i++) //using for loop for taking the
array elements
{
cout<< "\n Enter your
"<< i+1 <<" integer: ";// asking user for array
element
cin>>arr[i]; // storing in
array
sum= sum+arr[i]; // finding sum of
array elements
}
average = sum/n; // finding average of array
elements
cout<< "The average of the array elements: "
<<average <<"\n\n"; // printing average
for(i=0;i<n;i++) // for loop for counting the
elements below average
{
if(arr[i]<average) // checking
the elements whether it is below or not
{
count=count+1;
//counting
}
}
cout<< "Number of elements below the avarage
are: " <<count; // printing the number of elements below
average
}
Output: