# c++

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

1. 👍 0
2. 👎 0
3. 👁 102
1. 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 numVar-1
{
sum ← sum + num[i]
}
mean ← ((double)sum)/numVar
count=0
for i=0 to numVar-1
{
if num[i]>mean then
{
count ← count + 1
}
}
// output
Print numVar, mean, count

1. 👍 0
2. 👎 0

## Similar Questions

1. ### c++

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

asked by nethiyaa on May 10, 2011
2. ### Programming

Read two numbers from the keyboard Display the menu options as follows: 1 - computes the sum of two numbers. 2 - computes the difference (first minus second). 3 - computes the product of the two numbers. 4 - if the second number

asked by Shawn on October 30, 2012
3. ### Programming

I need your help to write a program using visual basic 2010 for the following:- write a program that calculates the average of up to 50 numbers input by the user and stored in an arrey. The program should use a class named

asked by Solomon on May 13, 2011
4. ### Programming

Here is the question that I need help to write the code for the following program in Visual Basic 2010. I am trying to write the code but it has a run time error. If your could helps me to write the code it would be greatly

asked by Solomon on May 18, 2011
5. ### computer

Write an algorithm for a program that accepts a set of numbers and finds the smallest among them and computes the sum of the numbers accepted. The program stops when the user enters number 999. Convert the algorithm into flowchart

asked by Anonymous on December 7, 2015
6. ### Programming

I suppose to write a program that calculates the average of up to 50 numbers input by the user and stored in an array. The program should use a class name Statistics and have an AddNumber method that stores numbers into an arrey

asked by Solomon on May 11, 2011
7. ### computer programming

Design the logic for a program that allows a user to enter any amount of numbers up to 10 or until a sentinal value of -1 is entered. Then the program displays the count of the numbers entered and numeric average of the numbers

asked by robert on February 28, 2017
8. ### computer science

Write a java program that reads from the user the course code, section and the scores of a student for three exams representing two midterms and a final. The percentage of each of the three exams is of fixed value 30, 30 and 40

asked by rayn on March 13, 2016
9. ### MATH

WRITE A SIMPLE BUT A COMPLETE FORTRAN PROGRAM TO COMPUTE THE AVERAGE OF SIX NUMBERS AND DISPLAY THE NUMBERS, SUM AND AVVERAGE. THE PROGRAM SHOULD TERMINATE WHEN ZERO IS ENTERED AS A NUMBER. THE PROGRAM SHOULD BE EDUCATIVE

asked by EDWIN on June 15, 2011
10. ### computer Science

1. Create a program which will allow the user enter ten numbers. The program is to count how many numbers were above 50. Hint: You will need to incorporate a Selection (If…then) statement.

asked by Jhon on January 25, 2016

More Similar Questions