Question

write a program that reads ten numbers, computes their average and find out how many numbers are above average.

Answers

Dr Russ
We are not going to do it for you. If you want to post what you have done and why it doesn't work as expected, we can make suggestions to correct/improve the program.
gabbi
int userVal=0;
int sum=0;
int avg=0;
int aboveAvg=0;

for(int i=0;i<11;i++)
{

cout<< "Enter a value"<<endl;
cin>> userVal;

sum=userVal+sum;

}

avg=sum/10;
cout<<avg<<endl;

for (int j=0;j<11;j++)
{

if(userVal>avg)
{
aboveAvg=userVal;
cout<<"Numbers above the average are "<<aboveAvg<<endl;
}
}

Related Questions