c++
posted by nethiyaa on .
write a program that reads ten numbers, computes their average and find out how many numbers are above average.

Since one of the requirements is to find out how many are above average, and there are only 10 numbers, it would be a good idea to store the numbers in an array so you would not have to read the numbers a second time.
Reading it more than once is not a good idea because we never know if the file has changed in the mean time.
You also have to know if the numbers are integers (int), or are they real numbers (double or float).
Eventually, the average will have to be a double or float using type cast.
Here's a possible pseudocode. Work on the coding, and post if you have further questions.
// start
Declare array of 10 numbers, num.
Declare variable sum, initialize to zero.
Declare numVar, initialize to 10.
Declare mean, initialize to zero.
Declare count, initialize to zero.
Read input numbers into array num.
// calculations
for i=0 to numVar1
{
sum ← sum + num[i]
}
mean ← ((double)sum)/numVar
count=0
for i=0 to numVar1
{
if num[i]>mean then
{
count ← count + 1
}
}
// output
Print numVar, mean, count